Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 group by date help

Author  Topic 

mikejohnson
Posting Yak Master

153 Posts

Posted - 2004-06-17 : 12:06:08
here is what my data looks like:

date Hits Complete %Complete
5/15/2004 3:11:19 PM 1 0 0.00%
5/15/2004 3:33:54 PM 1 0 0.00%
5/16/2004 5:29:35 PM 1 0 0.00%
5/16/2004 6:46:24 PM 1 0 0.00%
5/17/2004 9:33:21 AM 1 0 0.00%
5/17/2004 9:33:37 AM 1 0 0.00%

how can i group this information by day, week, month, and quarter? keep in mind i'd like to still display the entire date, not just the part of the date we're grouping by.

thanks!

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-06-17 : 12:18:56
If you posted DDL and DML for sample data, we'd better be able to help you. You are going to need to GROUP BY CONVERT with a style. Then to get the entire date, you would join to your GROUP BY query as a derived table.

Tara
Go to Top of Page

mikejohnson
Posting Yak Master

153 Posts

Posted - 2004-06-17 : 12:22:56
DDL? DML? Sample SQL would help me the best......
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-06-17 : 12:24:06
DDL is data definition language. CREATE TABLE statement for your table. DML is data manipulation language, which would be INSERT INTO statement for your sample data. Then we would need the expected result set using sample data. The reason why we need this information is that we need to be able to pull the info into Query Analyzer to test it out. We'd just be making guesses without it.

Tara
Go to Top of Page
   

- Advertisement -