How select records from related table not older then 3 months
Hello!
Actually the subject says it all.
I searched for a similiar question here, but did not find...
In table Treatments i need to have an average cost of a product i bought in a period (lets say 3 months).
Bought product prices are in table Orders.
More or less i understand that i have to SELECT records whose date is not older than 3 months from TODAY().
The only idea i came to, is i need a timestamp of three months to subtract from today's timestamp.
If there is a more "human" way to do that, please share!! ))
Thanks in advance!
Agassi
8 replies
-
Also ill appreciate a tip how to select top N records sorting DESC by Id.
-
Hi,
something like this?
---
let p := Product;
let d := today() - 180;
avg((select Order where Product = p and Date >= d).Price)---
-
Nickie, thank you very much for your answer!
And sorry for writing so late.
Do you know how to
select top 10 records when sorting DESC by Id? Something like LIMIT 10?
-
Agassi you are welcome, have a look at these posts:
-
Thank You Nick very much for the links!!
Sorry for "Nickie" in my other post, the phone autocorrected it i guess ).
-
Crap... and I thought you loved me!
lol
-
-
Nickie, my dear )),
my love and gratitude are limitless ;) jeje
Content aside
- 4 yrs agoLast active
- 8Replies
- 1101Views