I have a column in the table of type datetime.I need to get all the rows in the table but month wise.For Ex:
Jan 2003
(Rows whose date is in Jan 2003)
Feb 2003
(Rows whose date is in Feb2003)
.
.
.
Jan 2004
(Rows whose date is in Jan 2004)
Feb 2004
(Rows whose date is in Feb2004)
.
.
so on...
Can any body give my SQL query to get the desired results.
Thanks a lot,
Kumar.For January, 2003:
SELECT * FROM DateSample
WHERE MONTH(DateColumn) = 1 AND YEAR(DateColumn) = 2003
For February, 2003:
SELECT * FROM DateSample
WHERE MONTH(DateColumn) = 2 AND YEAR(DateColumn) = 2003
and so on...|||you need to use just simple order by this datetime field
if I understand your question
No comments:
Post a Comment