I'm building a POS system, where I collect the date & time that the event took place. I would like to pull some reports by only using the
DATE part of the datetime column in my SQL queries.
My current query looks like:
SELECT * FROM tbl_item_trans WHERE (date_time BETWEEN @start AND @end) ORDER BY date_time DESC, code
However, if I put in two dates e.g. 14th and 15th September it only pulls data from 14. If I want to include 15th September transactions, the end date would have to be 16th September.
How can I solve this problem? It would be better also if I only used the
DATE part of the
@end variables use the
date data type, e.g. '2017-09-16'.