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 |
IK1972
56 Posts |
Posted - 2014-08-29 : 18:14:17
|
I have table like thisCID OTID OID30922 2426 39621430928 2419 55155030930 2419 55155030931 2417 55155030925 2401 48361930929 2401 48361930940 2401 483619expected result is this. basicaly its group by OID and QTIDCID OTID OID30922 2426 39621430928,30930 2419 55155030931 2417 55155030925,30929,30940 2401 483619Thanks |
|
viggneshwar
Yak Posting Veteran
86 Posts |
Posted - 2015-01-09 : 01:00:35
|
select OTID, OID, ( Select CID from table t where t.OTID = a.OTID and t.OID = a.OID )from table agroup by OTID, OIDRegardsViggneshwar A |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2015-01-13 : 06:23:57
|
select distinct OTID, OID, stuff(( Select ','+cast( CID as varchar(50))from tableName twhere t.OTID = a.OTIDand t.OID = a.OID For XML path('')),1,1,'') CIDfrom tableName a--Chandu |
|
|
|
|
|