|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
easy question about "between" select statements
I have a simple SQL statement like follows:
"select * from my_table where recordDate between '01/01/2004' AND '02/01/2004'" As it is, this only returns records that are literally between those two dates, and doesnt return records that hit right on the start date or end date. What is the SQL command to make the between statement grab records inclusively, instead of exclusively as it is doing it now?
__________________
Brian |
|
#2
|
|||
|
|||
|
between is inclusive. The problem is that dates in SQL serber always includes a time portion. Your query is the same as
Code:
where recordDate between '01/01/2004 00:00:00' AND '02/01/2004 00:00:00' use Code:
where recordDate >= '2004-01-01 00:00:00' AND recordDate < '2004-01-03 00:00:00' instead. |
|
#3
|
|||
|
|||
|
Quote:
sweet, thanks. |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > easy question about "between" select statements |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|