General information
Forum:
Microsoft SQL Server
Environment versions
SQL Server:
SQL Server 2005
Hi All,
I have the OfferHeader and OfferDetail tables in a 1 to many relationship.
OfferHeader:
Batch
12345
67890
OfferDetail:
Batch EDP IsMainStock
12345 95 1
12345 96 0
12345 97 0
12345 98 0
67890 85 0
67890 86 1
67890 87 0
How can I structure a query to get the following result? Do I have to use a cursor or is there another way for example using PIVOT feature?
Result
Batch MainStockEDP ChildEDPs
12345 95 96|97|98
67890 86 85|87
Thank you,
Daniel
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only