0

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?

3 Answers 3

1

Use this, beacuse you're comparing strings not dates.

WHERE startdata>= DATE('2017-03-13) AND enddata<= DATE('2017-03-13)
Sign up to request clarification or add additional context in comments.

1 Comment

tnx. you save me
1
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'

6 Comments

sorry but i need to match if my data is between startdata and enddata. My data is 2017-03-13 startdata 2017-03-12 anddata 2017-03-19.
Did you create a table with two columns for date?
yes, i have created two columns for date, and this values contein the start and the end of range
just tested but not work, beacuse if i change data not work proprietly
The problem is that you have two date columns, the solution would be to work both, example: SELECT * FROM listino where startdata between (startdataValue AND enddataValue) AND enddata between (startdataValue AND enddataValue)
|
0

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

1 Comment

ok but , i need to look if the day is between on the startdata and enddata.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.