sales
-id
-user_id
-amount
-datetime
the sales table gets a new record for each user_id daily.
i want a select query that returns me all rows for the current day, only if the 'amount' is different that the previous days.
Update
5 123 700 2017/01/05
4 123 500 2017/01/04
3 123 1500 2017/01/03
2 123 1500 2017/01/02
1 123 500 2017/01/01
So if you search for records on the 5th, you will get 1 row since it is different that the previous days.
5 123 700 2017/01/05
But if you were run the query on the 3rd, since the amound $1500 is the same as on the 2nd, you will get 0 results back.
Hope this clears it up.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…