ASP Hosting sale!
Double disk space and transfer for FREE!
Limited time offer! Act Now!

aspdev | articles | tutorials | forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SQL statement problems

 
Post new topic   Reply to topic    ASPdev.org Forum Index -> SQL Programming (MS SQL Server, MS Access, MySQL)
View previous topic :: View next topic  
Author Message
newbie



Joined: 01 Oct 2004
Posts: 11

PostPosted: Fri Oct 01, 2004 6:53 pm    Post subject: SQL statement problems Reply with quote

I have a MS Access database with table called Users. How do I select all users that has been born between 1/1/1970 and 1/1/2000? I've tried the following SQL statement, but I got an error:

Code:
SELECT * FROM Users WHERE DOB > '1/1/1970' AND DOB < '1/1/2000'

_________________
I'm still learning..
Back to top
View user's profile Send private message
administrator
Site Admin


Joined: 01 Oct 2004
Posts: 183

PostPosted: Sat Oct 02, 2004 10:51 am    Post subject: Reply with quote

Instead of the single quotes you have put around your dates you need to use # character. This is the way MS Access expects the dates:

Code:
SELECT * FROM Users WHERE DOB > #1/1/1970# AND DOB < #1/1/2000#
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ASPdev.org Forum Index -> SQL Programming (MS SQL Server, MS Access, MySQL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group

SQL Tutorial