March 9, 2010 at 2:25 pm
Hi
I have two tables - OrderHeader and OrderDetail
Each table has an OrderNumber field. This also is the link to join them.
Each OrderDetail table also has a LineNumber table.
Each table has a field called Description.
There could be info in either Description field on the header or the line level.
I need to run SQL against these tables which will cause the Order Header's Descriuption to end up with the OrderHeader's Description set to the original contents of that field, followed by the concatenation of all of the descriptions (in any order) for the associated detail lines.
for example, there is an order number 3
Order number 3 has in the OrderHeader.Description the entry of "OrderLevelInfo".
Order number 3 has two detail records with their OrderNumber set to 3. One of the Descriptions is set to ABC and the other record is set to DEF.
I need an SQL script which will cause the OrderHeader.Description to be set to "OrderLevelInfo ABC DEF".
How do I do that?
Please help.
Thx
Regards
Vijji
March 9, 2010 at 2:38 pm
Vijji-429978
You will get tested assistance if you post the table definitions, some sample data and what you have attempted. Following the suggestions contained in the first link of my signature block.
March 9, 2010 at 7:37 pm
While we're waiting for a bit of readily consumable test data, I have to ask... WHY? What is the business reason that requires this type of denormalization? I ask because I'm not only curious but sometimes there's a better way depending on the business reason for the requirement.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply