SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 grouping on day query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

masterdineen
Aged Yak Warrior

United Kingdom
545 Posts

Posted - 02/06/2013 :  11:52:30  Show Profile  Reply with Quote
hello there,

I am trying to select on some ticketing data, but the data column is datetime.

i want to do a select that groups by the date only.

at the moment my query looks like.

select transactionpurchasedate as 'Date', COUNT(transactionid) as 'Count'
from Ticket_Facts
group by transactionpurchasedate
order by transactionpurchasedate asc

how can i group just on date and not datetime.

masterdineen
Aged Yak Warrior

United Kingdom
545 Posts

Posted - 02/06/2013 :  11:53:59  Show Profile  Reply with Quote
its ok ive done it

brain wave

select convert(date,transactionpurchasedate) as 'Date', COUNT(transactionid) as 'Count'
from Ticket_Facts
group by convert(date,transactionpurchasedate)
order by convert(date,transactionpurchasedate) asc
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000