Makara
Makara

Reputation: 233

SQLserver query rows in between specific date

how could i get row by filtering in between specific date...

in my table, i have thousand of rows about Ordered Food.

I want to check ordered food between June-01-2011 1:00:00PM to June-05-2011 6:00:00pm. how could i suppose to write t-sql code...

Upvotes: 2

Views: 3733

Answers (2)

NullRef
NullRef

Reputation: 3743

Making some wild assumption about your table structure basically do this...

Select * from ordered_food 
where ordered_date 
between '2011-06-01 13:00:00' and '2011-06-05 18:00:00'

Upvotes: 1

Alex Aza
Alex Aza

Reputation: 78457

 select *
 from MyTable
 where MyDate >= `2011-06-01T13:00:00` and  MyDate < '2011-06-05T18:00:00'

if you want to include both datetimes:

 select *
 from MyTable
 where MyDate between `2011-06-01T13:00:00` and  '2011-06-05T18:00:00'

Upvotes: 2

Related Questions