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
 Transact-SQL (2000)
 special group by data

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-12-30 : 12:11:31
Erng writes "I try to find out the query that group by data by gap and date but it has some confuse that how can I group by those gap when it have same gap with different period ....

Source data :
Date Gap
01/01/2003 0.1
01/02/2003 0.1
01/03/2003 0.1
01/04/2003 0.2
01/05/2003 0.2
01/06/2003 0.1
01/07/2003 0.1
01/08/2003 0.3
01/09/2003 0.3

Result data that I need are as follow :
Date Gap
01/01/2003 - 01/03/2003 0.1
01/04/2003 - 01/05/2003 0.2
01/06/2003 - 01/07/2003 0.1
01/08/2003 - 01/09/2003 0.3

I try to use query group by gap and select min/max date . I got the wrong result... Have any Idea Please Help????"

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-12-30 : 12:17:13
check out the articles section of this site for my articles on "Detecting Runs and Streaks in your data". it shows this exact techinque. let me know how it goes.

- Jeff
Go to Top of Page
   

- Advertisement -