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.
| Author |
Topic |
|
Husman
Starting Member
13 Posts |
Posted - 2007-04-04 : 06:59:25
|
| I'm new to sql. Can someone help me to write a script to select overlapping start dates for each client records. For example:Clientid 1 have 3 episode as below(I only want to see the first two records with overlapping start date records)clientid StratDate EndDate1 2004-01-01 2004-05-01 1 2004-04-01 2004-05-01 1 2005-04-01 2006-01-01 Table createCREATE TABLE [dbo].[TABLE_TEST] ( [Client_ID] [varchar] (15) COLLATE Latin1_General_CI_AS NULL , [STARTDate] [datetime] NULL , [ENDDate] [datetime] NULL ,) GOINSERT INSERT INTO [TABLE_TEST]([Trust_Wide_ID], [STARTDate], [ENDDate])VALUES('1','2004-01-01','2004-05-01')INSERT INTO [TABLE_TEST]([Trust_Wide_ID], [STARTDate], [ENDDate])VALUES('1','2004-04-01','2004-05-01')INSERT INTO [TABLE_TEST]([Trust_Wide_ID], [STARTDate], [ENDDate])VALUES('1','2005-04-01','2006-04-01')INSERT INTO [TABLE_TEST]([Trust_Wide_ID], [STARTDate], [ENDDate])VALUES('2','2004-06-01','2004-07-01')INSERT INTO [TABLE_TEST]([Trust_Wide_ID], [STARTDate], [ENDDate])VALUES('3','2004-09-01','2004-010-01')GoThanks for helpHusman |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-04 : 07:01:31
|
| Duplicate post: [url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=81637[/url]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|
|
|
|