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)
 can I use a cursor

Author  Topic 

sgadmin
Starting Member

8 Posts

Posted - 2007-08-01 : 13:20:22
Hi,

I have a large table containing contract information like this:

CTRCID ITEMID SERIAL
23 520 ABCDEF
23 400
23 300
23 220
13 300 GHIJKL
13 560

I need to provide output in one table with one row per Serial like this:

CTRID

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-08-01 : 13:23:54
think this is what you want. http://sqljunkies.com/WebLog/amachanic/archive/2004/11/10/5065.aspx


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

sgadmin
Starting Member

8 Posts

Posted - 2007-08-01 : 13:31:28
Oops; sent too soon...here goes again:

Hi,

I have a large table containing contract information like this:

CTRCID ITEMID SERIAL
23 520 ABCDEF
23 400
23 300
23 220
13 300 GHIJKL
13 560

I need to provide output in one table with one row per contract like this:

CTRID ITEMIDCA1 ITEMID2 ITEMID3 ITEMID4 ITEMID 5 SERIAL
23 520 400 300 220 ABCDEF
13 300 560

I can do a case statement to set the ITEMID#'s based on the value, however, I need to get the information in one row vs multi rows.

Go to Top of Page
   

- Advertisement -