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 |
|
tim8w
Starting Member
10 Posts |
Posted - 2010-10-27 : 16:18:24
|
| I have this selection that returns 5 fields. I would like to combine lines returned that have a common 'ReferenceNumber'. Here's my query:SELECT tabMedia.ReferenceNumber, tabReferenceNoInfo.Title, tabMediaTypeLookup.Media, tabReplicatorLookup.ReplicatorName, tabMedia.FinishDateFROM tabMedia INNER JOIN tabReferenceNoInfo ON tabMedia.ReferenceNumber = tabReferenceNoInfo.ReferenceNumber INNER JOIN tabMediaTypeLookup ON tabMedia.MediaTypeID = tabMediaTypeLookup.MediaTypeID INNER JOIN tabReplicatorLookup ON tabMedia.ShipToCompanyID = tabReplicatorLookup.ReplicatorIDWHERE (tabMedia.ReferenceNumber IN ('392185','392366','392424','392717','392721','392723','392798','393001','444000'))ORDER BY tabMedia.ReferenceNumber ASCThis query generates something like this for output:ReferenceNumber Title ReplicatorName392424 This is the Title Location1392424 This is the Title Location2392424 This is the Title Location3444000 This is the Title Location2Is there an easy way to combine the common ReferenceNumber entries to generate something more like this:ReferenceNumber Title ReplicatorName ReplicatorName ReplicatorName392424 This is the Title Location1 Location2 Location3 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-11-01 : 12:29:02
|
| will you be certain of the number of ReplicatorNames always?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|