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 |
|
sg2255551
Constraint Violating Yak Guru
274 Posts |
Posted - 2009-12-07 : 06:32:59
|
| hiI have 2 tables namely Order and Order DetailOrderOrderID CustID0001 10002 2Order DetailOrderID CustID ProductName Remark0001 1 A Good0001 1 B Bad0001 1 C Ok0002 2 A Good0002 2 Z Ok0002 2 D OKHow do i achieve this. The 3rd column is a concatenate of 3 orders into a OD field. ThanksOrderID CustID OD0001 1 A-Good,B-Bad,C-OK0002 2 A-Good,Z-OK,D-OKThanks |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
sg2255551
Constraint Violating Yak Guru
274 Posts |
Posted - 2009-12-07 : 07:36:08
|
| hiSorry, perhaps i should change the table structure:I have 2 tables namely Order and Order DetailOrderOrderID CustID CustName0001 1 John0002 2 KentOrder DetailOrderID CustID ProductName Remark0001 1 A Good0001 1 B Bad0001 1 C Ok0002 2 A Good0002 2 Z Ok0002 2 D OKIf i would to select Custname, OrderID, ProductName, Remark from Order join Order Detail, it would have a result of 6 rows.But how do i achieve just 2 rows likeCustName OrderID ODJohn,0001,A-Good,B-Bad,C-OKkent,0002,A-Good,Z-OK,D-OKThanks a lot. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-12-07 : 07:44:34
|
Use the method in the link i posted. KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
sg2255551
Constraint Violating Yak Guru
274 Posts |
Posted - 2009-12-07 : 10:15:04
|
| Thanks |
 |
|
|
|
|
|
|
|