x
login about faq Site discussion (meta-askssc)

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 '10 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 '10 at 01:17 PM

Squirrel 1 gravatar image

Squirrel 1
1.6k 1 3

that should put you over 1K :)

May 18 '10 at 08:15 PM Scot Hauder

ha ha. Thanks Scot

May 19 '10 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 '12 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.

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



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x1843

asked: May 18 '10 at 11:47 AM

Seen: 884 times

Last Updated: Sep 07 '12 at 12:41 PM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.