Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Select between statement


Message #1 by "Ryan vd Merwe" <ryan@8...> on Fri, 19 Apr 2002 10:15:13 +0200
Hi

What does the SQL statement look like if I want to select records between
two dates.

Thanks
Ryan

Message #2 by bobby.sojitra@b... on Fri, 19 Apr 2002 09:23:43 +0100
Try : 

"SELECT * FROM tblRecords WHERE [Date] > '01/01/2002' AND [Date] <
'15/05/2002'"

This will select all records between '01/01/2002' and '15/05/2002'. Bear in
mind 
that the field [Date] in your table must be of type DateTime or whatever the

equivalent is in the database in which you are using. DateTime refers to SQL
server.

Hope that helps dude.

Bobby.

-----Original Message-----
From: Ryan vd Merwe [mailto:ryan@8...]
Sent: 19 April 2002 09:15
To: ASP Web HowTo
Subject: [asp_web_howto] Select between statement


Hi

What does the SQL statement look like if I want to select records between
two dates.

Thanks
Ryan



---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
Message #3 by pranot.mengle@b... on Fri, 19 Apr 2002 11:16:18 +0100
for ORACLE databases, use BETWEEN keyword in your query
eg.
select * from tableName where trunc(dateField) between to_date('" & fromdate
& "', 'dd-mm-yyyy') and " _
							&" to_date('" &
todate & "', 'dd-mm-yyyy') "

here "fromdate" & "todate" are 2 ASP variables in the format "dd/mm/yyyy". 



> -----Original Message-----
> From:	Sojitra,B,Bobby,YED11A C 
> Sent:	Friday, April 19, 2002 9:24 AM
> To:	ASP Web HowTo
> Subject:	[asp_web_howto] RE: Select between statement
> 
> Try : 
> 
> "SELECT * FROM tblRecords WHERE [Date] > '01/01/2002' AND [Date] <
> '15/05/2002'"
> 
> This will select all records between '01/01/2002' and '15/05/2002'. Bear
> in
> mind 
> that the field [Date] in your table must be of type DateTime or whatever
> the
> 
> equivalent is in the database in which you are using. DateTime refers to
> SQL
> server.
> 
> Hope that helps dude.
> 
> Bobby.
> 
> -----Original Message-----
> From: Ryan vd Merwe [mailto:ryan@8...]
> Sent: 19 April 2002 09:15
> To: ASP Web HowTo
> Subject: [asp_web_howto] Select between statement
> 
> 
> Hi
> 
> What does the SQL statement look like if I want to select records between
> two dates.
> 
> Thanks
> Ryan
> 
> 
> 
> ---
> 
> Improve your web design skills with these new books from Glasshaus.
> 
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
> 
> 
> ---
> 
> Improve your web design skills with these new books from Glasshaus.
> 
> Usable Web Menus
> http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
> http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
> http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
Message #4 by Joe Ingle <Joe@k...> on Fri, 19 Apr 2002 11:34:22 +0100
Being a bit picky, but:

"SELECT * FROM tblRecords WHERE [Date] > '01/01/2002' AND [Date] <
'15/05/2002'"

This will select all records between '02/01/2002' and '14/05/2002'.

needs to be:

"SELECT * FROM tblRecords WHERE [Date] >= '01/01/2002' AND [Date] <
'15/05/2002'"

Joe :-)

-----Original Message-----
From: bobby.sojitra@b... [mailto:bobby.sojitra@b...]
Sent: Friday, April 19, 2002 9:24 AM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Select between statement


Try : 

"SELECT * FROM tblRecords WHERE [Date] > '01/01/2002' AND [Date] <
'15/05/2002'"

This will select all records between '01/01/2002' and '15/05/2002'. Bear in
mind 
that the field [Date] in your table must be of type DateTime or whatever the

equivalent is in the database in which you are using. DateTime refers to SQL
server.

Hope that helps dude.

Bobby.

-----Original Message-----
From: Ryan vd Merwe [mailto:ryan@8...]
Sent: 19 April 2002 09:15
To: ASP Web HowTo
Subject: [asp_web_howto] Select between statement


Hi

What does the SQL statement look like if I want to select records between
two dates.

Thanks
Ryan



---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20


---

Improve your web design skills with these new books from Glasshaus.

Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20

  Return to Index