开发者

PLSQL WHERE date_time is in a range of dates

开发者 https://www.devze.com 2023-01-09 09:52 出处:网络
I have two date strings, in the format MM/DD/YYYY and would like to query an Oracle database for any records between those two dates.How do I do this succ开发者_开发技巧inctly and simply?Use the TO_DA

I have two date strings, in the format MM/DD/YYYY and would like to query an Oracle database for any records between those two dates. How do I do this succ开发者_开发技巧inctly and simply?


Use the TO_DATE function:

WHERE date_column BETWEEN TO_DATE(start, 'MM/DD/YYYY')
                      AND TO_DATE(end, 'MM/DD/YYYY')


Try this,

SELECT * FROM table WHERE date BETWEEN to_date('01/05/2010','mm/dd/yyyy') AND to_date('10/01/2010','mm/dd/yyyy') ORDER BY date ASC
0

精彩评论

暂无评论...
验证码 换一张
取 消