Ankita Singh
Ankita Singh

Reputation: 314

Filter Not Working on date

Please help me in applying a filter I am using a query, but it's not working in my case

SELECT *
FROM transactionList
WHERE transactionDate >= '2018-05-29' AND transactionDate <= '2018-04-29'
LIMIT 20 OFFSET 0

Upvotes: 0

Views: 448

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 521093

It looks like you have the date range backwards. You probably intended to find all records whose transactions took place between 29-April-2018 and 29-May-2018:

SELECT *
FROM transactionList
WHERE transactionDate BETWEEN '2018-04-29' AND '2018-05-29'
LIMIT 20;

Note that in this case you may use the BETWEEN operator, which is inclusive on both ends, instead of the more verbose way you phrased the date range.

Upvotes: 1

Related Questions