x

show data month wise

i want to show data according to month like January,febuary.... i use this query

Select v.varient,h.operator,Datename(month,h.dateofhit) as m_month,count(h.content_id) as No_of_hits from Tbl_hiturl h,tbl_varient v where v.content_id=h.content_id and h.state='haryana' group by v.varient,h.operator,Datename(month,h.dateofhit)

it show april first that is it order by string of month

howw to solve it please reply sooon

Thanks in advance Regards HArdeep singh

more ▼

asked May 18, 2010 at 11:47 AM in Default

avatar image

Hardeep
1 1 1 1

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first

add a ORDER BY

order by datepart(month, h.dateofhit)

more ▼

answered May 18, 2010 at 01:17 PM

avatar image

Squirrel 1
1.6k 1 3 5

(comments are locked)
10|1200 characters needed characters left

SELECT sum(rateit) as ratecount , datename(month,commentdate) as 'MonthName' from Home_Commentdetails group by datename(month,commentdate)

more ▼

answered Sep 07, 2012 at 12:41 PM

avatar image

lohithkumar
0

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x2018

asked: May 18, 2010 at 11:47 AM

Seen: 1742 times

Last Updated: Sep 07, 2012 at 12:41 PM

Copyright 2016 Redgate Software. Privacy Policy