• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 263
  • Last Modified:

SQL 2008 Query

I have a table called plant, a column called Date Rec and info as follows:

4/10/2010 0:00
4/20/2010 0:00
6/16/2010 0:00
6/17/2010 0:00
9/14/2010 0:00
9/14/2010 0:00
9/15/2010 0:00
9/17/2010 0:00


I need to select all data that is later  than 7-31-2010 and and earlier than 7-31-2011

Can anyone help me with a basic query on this?

THANKS!!

 
0
Curtis Long
Asked:
Curtis Long
  • 2
2 Solutions
 
ralmadaCommented:
like this

select * from plant where [Date Rec] > '2010-07-31' and [Date Rec] < '2011-07-31'
0
 
pivarCommented:
Hi,

If the data it's just date (that is, timeportion is always 0:00) try

select * from yourtable where yourdate between '8-1-2010' between '7-30-2011'

/peter
0
 
ralmadaCommented:
or if there's a time portion involved

select * from plant where [Date Rec] >= '2010-08-01' and [Date Rec] < '2011-07-31'
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now