Wednesday, March 21, 2012

DateTime Problem

i'm having a web forum, i wanna make a page to show all today's posts, so for instance i tried to do this in the SQL statment:

Where Posts.DatePosted Between #09/20/2005# AND #09/22/2005#

but this erroe appeared to me:
Incorrect syntax near '#'
so can you please tell me better way and exact way to do this, thanx too much

That syntax is for Access. Your best bet is something like this:
Where Posts.DatePosted >= '20050920' ANDPosts.DatePosted < '20050923'

|||thanx too much it worked pretty fine, but i made it like this and its perfect:

HAVING MAX(Posts.DatePosted) >= '09/22/2005' AND MAX(Posts.DatePosted) < '09/23/2005'

No comments:

Post a Comment