I am trying to search in a database for a record with a specific date. I have tried to search in the following ways:
SELECT * to TABLE_1 WHERE CAL_DATE = 01/01/2015
and
< Pre> SELECT * TABLE_1 WHERE CAL_DATE = '01 / 01/2015 '
I am working with an Access database, and in the table, dates are showing in dates The same format (01/01/2015) Do I miss something in the SQL statement?
Any of the following options should work:
Direct date Format query in.
SELECT * FROM TABLE_1 WHERE CAL_DATE = # 01/01/2015 #;
The date value function will convert a string to a date.
SELECT * FROM TABLE_1 WHERE CAL_DATE = DateValue ('01 / 01/2015 ');
The CDAT function will convert a value to a date.
SELECT * FROM TABLE_1 WHERE CAL_DATE = CDAT ('01 / 01/2015 ');
The date serial function will return the date given by the year, month and day.
SELECT * FROM TABLE_1 WHERE CAL_DATE = DateSerial (2015, 1, 1);
See the following pages for more information on the above tasks:
No comments:
Post a Comment