Reputation: 731
Above is My data screenshot. I need to select catalog if it ranges between the from date and to date. My query is "select catalog from hhItemDiscountOne where fromDate >= '20190305' and toDate <= '20190305'
". But i didn't get values even though the date is between the range.
Upvotes: 0
Views: 27
Reputation: 4641
This is a mistake I often make on first sight. You are mixing the from and to conditions.
There is no entry with a fromDate >= '20190305', they are both '20190301' which is smaller. So if you are searching values where the date is in the range, your condition needs to be
fromDate <= '20190305' and toDate >= '20190305'
The <=
and >=
are turned
Upvotes: 1