I have a table like this:
id descripcion precio fecha
1 gomitas 5 1/2/2020
1 gomitas 2 2/3/2020
2 DRF 56 2/3/2020
3 BULLDOG 8 2/3/2020
1 gomitas 10 1/3/2020
3 BULLDOG 9 1/4/2020
2 DRF 7 1/4/2020
And this is the desired result:
id precio fecha
1 2 2/3/2020
2 7 1/4/2020
3 9 1/4/2020
That is, group by product (its id), with the maximum date, giving the price detail. In short, to give me the last price of a certain product.
I tried this:
=QUERY(A:D,"SELECT A,C, MAX(D) GROUP BY (A)")
But it asks me to group C (price column). Which doesn't work for me. I found this too:
=query(A:D,"SELECT A,C,D ORDER BY D DESC LIMIT 3")
But it doesn't work for me, because the limit is variable.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.