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

Hardeep gravatar 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

Squirrel 1 gravatar image

Squirrel 1
1.6k 1 3

that should put you over 1K :)
May 18, 2010 at 08:15 PM Scot Hauder
ha ha. Thanks Scot
May 19, 2010 at 03:06 AM Squirrel 1
(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

lohithkumar gravatar 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.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

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:

x1948

asked: May 18, 2010 at 11:47 AM

Seen: 1500 times

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