472,127 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,127 software developers and data experts.

How to query date between?

zdk
I have table name "actionlog",and one field in there is "date_time"
date_time (Type:datetime) example value : 11/1/2006 11:05:07

if I'd like to query date between 24/07/2006 to 26/07/2006(I don't
need time),how to write SQL command?

select * from actionlog where date_time 24/07/2006 AND date_time <
24/07/2006 ??

Jul 26 '06 #1
2 38892
query is correct but you will need to format your date like so yyyy-MM-dd

YourSQL = "select * from table where date_col < " +
yourdate.tostring("yyyy-MM-dd") " AND ..."

"zdk" <nx****@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
>I have table name "actionlog",and one field in there is "date_time"
date_time (Type:datetime) example value : 11/1/2006 11:05:07

if I'd like to query date between 24/07/2006 to 26/07/2006(I don't
need time),how to write SQL command?

select * from actionlog where date_time 24/07/2006 AND date_time <
24/07/2006 ??

Jul 26 '06 #2
zdk
Thanks a lot.

Jared wrote:
query is correct but you will need to format your date like so yyyy-MM-dd

YourSQL = "select * from table where date_col < " +
yourdate.tostring("yyyy-MM-dd") " AND ..."

"zdk" <nx****@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I have table name "actionlog",and one field in there is "date_time"
date_time (Type:datetime) example value : 11/1/2006 11:05:07

if I'd like to query date between 24/07/2006 to 26/07/2006(I don't
need time),how to write SQL command?

select * from actionlog where date_time 24/07/2006 AND date_time <
24/07/2006 ??
Jul 26 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Adam Louis | last post: by
10 posts views Thread by Kenneth | last post: by
11 posts views Thread by Andy_Khosravi | last post: by
10 posts views Thread by Daniel | last post: by
12 posts views Thread by Michel Esber | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.