Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List rows after specific date

I have a column in my database called "dob" of type datetime. How do I select all the rows after a specific DoB in SQL Server 2005?

like image 794
Baz Avatar asked Mar 02 '12 11:03

Baz


People also ask

Can you group by date in SQL?

To group by date part, use the GROUP BY clause and the EXTRACT() function.


1 Answers

Simply put:

SELECT *  FROM TABLE_NAME WHERE dob > '1/21/2012' 

Where 1/21/2012 is the date and you want all data, including that date.

SELECT *  FROM TABLE_NAME WHERE dob BETWEEN '1/21/2012' AND '2/22/2012' 

Use a between if you're selecting time between two dates

like image 84
cgatian Avatar answered Oct 21 '22 19:10

cgatian