SQLTeam.com | Weblogs | Forums

Query to sort data on Year and month

sql2008r2

#1

Hi, I have queried 2 tables to get few columns with date column.
Can some one help me with the query to sort the records by Year and Month.


#2

not without your table definitions and your query


#3

I have a table with the following columns - Registered date, Posts, Comments, Cost. I created a query to group by Registered date to get the final counts. So now I have to edit the query to sort the registered date based on the year and month.


#4

You need to post your existing query for us to help you. Without that, i can only guess that you need to add a order by clause to your query

ORDER BY [Registered date]