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 |
|
Chengli
Starting Member
10 Posts |
Posted - 2008-07-14 : 07:05:16
|
| i got the problem when i would like to display data. for example :table : monitor : M_Id, M_Model MonitorCopy: M_id, Mcopy_ID,M_status Cpu: C_Id, C_Model CpuCopy : C_ID, Ccopy_Id,C_Model GetPC : GETPC_ID, C_ID, Ccopy_Id, M_id, Mcopy_IDand then i would like to display data like that-----------------------------------GETPC_ID C_Model M_Model---------------------------------- |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-14 : 07:13:31
|
Didnt understand the difficulty here. A straightforward join will give you the desired result.SELECT g.GETPC_ID,c.C_Model,m.M_ModelFROM GetPC gINNER JOIN Cpu c ON c.C_Id,=g.C_IdINNER JOIN monitor m ON m.M_id=g.M_id |
 |
|
|
Chengli
Starting Member
10 Posts |
Posted - 2008-07-14 : 07:18:44
|
| sorry to all of u ... forget to say thatThe data display i only want to show the data in the GetPC.For example:table- getPc--------------------------------- GETPC_ID C_ID Ccopy_Id M_id Mcopy_ID p1 c1 cp1 m1 mc1table - Cpu--------------------------------- C_ID cModel c1 Hp c2 Acer---------------------------------table - CpuCopy--------------------------------- C_ID Ccopy_Id status c1 CP1 Yes c2 1p2 no---------------------------------Data i would like to dis play is like that : GETPC_ID C_Model p1 Hp |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-07-14 : 07:25:53
|
| SELECT G.GETPC_ID,C.C_MODELFROM GETPC GINNER JOIN CPU C ON C.C_ID = G.C_ID |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-07-14 : 08:02:46
|
quote: Originally posted by Chengli sorry to all of u ... forget to say thatThe data display i only want to show the data in the GetPC.For example:table- getPc--------------------------------- GETPC_ID C_ID Ccopy_Id M_id Mcopy_ID p1 c1 cp1 m1 mc1table - Cpu--------------------------------- C_ID cModel c1 Hp c2 Acer---------------------------------table - CpuCopy--------------------------------- C_ID Ccopy_Id status c1 CP1 Yes c2 1p2 no---------------------------------Data i would like to dis play is like that : GETPC_ID C_Model p1 Hp
cant you try this modification from solution provided earlier? |
 |
|
|
|
|
|
|
|