Reputation: 107
I'm looking to create this query but nothing.
I need to get some values between two dates.
MY table contain id, value, startdata, enddata.
id=1; value=x; startdata=2017-03-12; enddata=2017-03-19
startdata and enddata are DATA Type.
My query :
SELECT * FROM listino where startdata>='2017-03-13' AND enddata<='2017-03-13'
but no work. how to get value from this table?
Upvotes: 0
Views: 305
Reputation: 470
Use this, beacuse you're comparing strings not dates.
WHERE startdata>= DATE('2017-03-13) AND enddata<= DATE('2017-03-13)
Upvotes: 1
Reputation: 1971
Try this codes. It helpful this problem.
Select * from listino where dates between '2017/03/12' and '2017/03/19'
Or
Select * from listino where dates between startdate and enddate
Upvotes: 0
Reputation: 63
SELECT * FROM listino where startdata = '2017-03-13'
or
SELECT * FROM listino where startdata between ('2017-03-13' AND '2017-03-13')
or
SELECT * FROM listino where startdata between '2017-03-13' AND '2017-03-13'
Upvotes: 1