Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query help
Message
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Query help
Environment versions
SQL Server:
SQL Server 2005
Miscellaneous
Thread ID:
01350738
Message ID:
01350738
Views:
61
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
Map
View

Click here to load this message in the networking platform