Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: using between and/or >< signs to get records between dates


Message #1 by dont worry <aspmailbox@y...> on Wed, 31 Jan 2001 12:17:24 -0800 (PST)
If you don't specify a time in your criteria SQL assumes midnight (00:00:000)

Try this:

WHERE Date BETWEEN '1/1/01' AND '2/1/01' 

Essentially; "where the date is between midnight jan 1st 2001 and midnight feb 1st 2001"

If that doesn't work ... I don't know what the problem could be

Good luck and don't worry

-G


-----Original Message-----
From:	dont worry [SMTP:aspmailbox@y...]
Sent:	Wednesday, January 31, 2001 4:05 PM
To:	sql language
Subject:	[sql_language] RE: using between and/or >< signs to get records between  dates

Is their times in the date field and I tried  >= < and
it doesnt work?

--- gnormandin <gnormandin@s...> wrote:
> How about :
> WHERE (Date >= '20001-1-01' AND Date <
> '2001-01-31')
> 
> But the BETWEEN operator should do that for you ...
> are ther times in your date field?
> 
> -G
> 
> 
> -----Original Message-----
> From:	dont worry [SMTP:aspmailbox@y...]
> Sent:	Wednesday, January 31, 2001 10:45 PM
> To:	sql language
> Subject:	[sql_language] using between and/or ><
> signs to get records between  dates
> 
> I need all records from 1st day till last day of
> month.
> I'be tried between and > < see below, but I dont get
> the ones for the 1st day or the last?  I'm using asp
> script to get the dates and pass them as variables,
> hard coded below for ease.
> 
> SELECT  *
> FROM USERS 
> WHERE (Date > '2001-1-01')  AND (Date < '2001-01-31'
> )
> 
> 
> SELECT *
> FROM USERS
> WHERE (Date between  '2001-1-01'AND '2001-01-31' )
> 

  Return to Index