0
Guys I’m beginner in SQL and it’s complicated to solve this problem that came up.. I need a select in SQL-Server that returns: the sales of the last seven days.
For example if the last day there was sale, was on 10/04/2019, then the query should show sales between 04/04/2019 and 10/04/2019.
The logic I believe is correct, but I do not know the proper commands to make this select... Thanks there who can help me!! : D
SELECT * FROM vendas
where ven_data <= max(ven_data)
and ven_data >= max(ven_data - 7)
Would it be based on the current day? Kind today - 7?
– Daniel Mendes
No, it would be from the last product sold. For example if the last sale was on 10/04/2019 then the result would be between 04/04/2019 and 10/04/2019
– smuk