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)
 How to make this query?

Author  Topic 

donar
Starting Member

22 Posts

Posted - 2006-01-24 : 12:14:49
Hi guys, need your help again!

I have a table,
create table #temptable (
ISN int, NTS varchar(7), start int, ends int)

insert into #temptable (isn, nts, start, ends)
select 1, '12C/01A', 2, 15
union
select 1, '12C/01A', 25, 101
union
select 1, '12D/07B', 11, 11
union
select 2, '10A/12C', 23, 25

My question is, how can I get the query result like this
ISN RESULT
1 '12C/01A'(2-15, 25-101); '12D/07B' (11)
2 '10A/12C' (23-25)

Thanks for help. I do not want to use curser on this problem, is there other way to do it?

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-01-24 : 12:41:53
C whether the following is useful


http://sqljunkies.com/WebLog/amachanic/archive/2004/11/10/5065.aspx?Pending=true
Go to Top of Page

donar
Starting Member

22 Posts

Posted - 2006-01-24 : 13:16:15
Thanks for your reply. but I do not think it is just a problem of concatenation. There is group by too. How can I group by Isn,NTS and put the 'start-end' to the group they belong to?
Go to Top of Page
   

- Advertisement -