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

Wow, perfect timing. There was a thread yesterday on a similar question in APS.NET forum / SQL Server

See this link http://sqljunkies.com/WebLog/amachanic/archive/2004/11/10/5065.aspx?Pending=true which I put in favorites from that thread (need to search for it).
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform