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 |
jung1975
Aged Yak Warrior
503 Posts |
Posted - 2006-09-13 : 12:06:47
|
I have two tables: data and note Data tableName Inc Amt KeyJohn Med 200 1John Med 300.89 1John Med 333 3John MDD 234 4Mary Mec 345,88 5Mary Mec 111 5Note tableKey Desc1 6 month pre-xting1 Payor is secure3 Spoke to elis 4 Recreation Receipt5 No records for this person5 Need to call 000-0000I would like to return the output looks like below: I would like to group the data table by name, Inc, sum (amt) and attach the concatenated “Desc”Name Inc Amt DescJohn Med 833.89 6 month pre-xting, Payor is secure, Spoke to elisJohn Med 333 Recreation ReceiptMary Mec 145.88 No records for this person, Need to call 000-0000 |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-09-13 : 12:56:39
|
Create a function to get the concatenated descriptions from the note table and call it in the select statement with the key.The aggregate should be easy - but why do you include key 3 with 1 for john med and also separately.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
|
|