Advertisement

03.13.2007 at 08:33PM PDT, ID: 22447900
[x]
Attachment Details

Group by clause in sql server

Asked by pai_prasad in SQL Server 2005

Tags: clause, group, server

I want to group data according to the eventdate time range for every 2 mins...and have the min recd of that grp,,

meaning i want the result as

1 2007-03-13
1 2007-03-15
1 2007-03-17

and so on...




use tempdb
create table testGroup ( msid int , eventdate datetime )

Insert into testGroup values (1, getDate())
Insert into testGroup values (1, getDate()+1)
Insert into testGroup values (1, getDate()+2)
Insert into testGroup values (1, getDate()+3)
Insert into testGroup values (1, getDate()+4)
Insert into testGroup values (1, getDate()+5)
Insert into testGroup values (1, getDate()+6)
Insert into testGroup values (1, getDate()+7)
Insert into testGroup values (1, getDate()+8)

/*
1      2007-03-13 20:17:22.773
1      2007-03-14 20:17:22.773
1      2007-03-15 20:17:22.773
1      2007-03-16 20:17:22.773
1      2007-03-17 20:17:22.773
1      2007-03-18 20:17:22.773
1      2007-03-19 20:17:22.773
1      2007-03-20 20:17:22.773
1      2007-03-21 20:17:22.773
*/Start Free Trial
[+][-]03.13.2007 at 10:34PM PDT, ID: 18716279

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 10:48PM PDT, ID: 18716312

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 10:55PM PDT, ID: 18716331

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 11:13PM PDT, ID: 18716388

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 11:23PM PDT, ID: 18716425

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 11:28PM PDT, ID: 18716438

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 11:31PM PDT, ID: 18716452

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 11:35PM PDT, ID: 18716464

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.13.2007 at 11:42PM PDT, ID: 18716490

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.14.2007 at 12:49AM PDT, ID: 18716718

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Server 2005
Tags: clause, group, server
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32