I have a table called sales which is displayed below:
s.no item_sold date
1 soap 25.07.2017
2 bisket 19.07.2017
3 chocklate 26.06.2017
4 milk 26.06.2016
Use subdate(current_date, 1) and BETWEEN.
Eg. To get records between yesterday and day before yesterday. You can do something like this:
SELECT .. FROM ... WHERE your_date_column BETWEEN
subdate(current_date, 1) AND subdate(current_date, 2)
Uh... I guess...
select * from sales where date between '2017-06-01' and '2017-07-31'
But I think your field name "date" and "s.no" are going to cause you problems...
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.