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 |
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2008-03-25 : 12:23:54
|
| hi, this is my db tables: groupallocation groupid(primarykey) groupnamesystemallocation systemid(primarykey) systemnamedeviceallocation deviceid(primarykey) devicenamesensorallocation sensorid(primarykey) sensorname groupid(foreignkey) systemid(foreignkey) deviceid(foreignkey)so i want to make a query in sensorallocation table should display as like folllows: i want to make query to join the tables and display the following fields.sensorid,sensorname,groupname,systemname,devicenamebecos in sensorallocation table i do have only groupid,systemid,deviceid only but while displaying i need to display groupname,systemname,devicename |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2008-03-25 : 12:46:24
|
| sample data?sample output?[Signature]For fast help, follow this link:http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspxLearn SQL or How to sell Used CarsFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2008-03-25 : 12:57:46
|
| [code]Selectra.sensorid, ra.sensorname, ga.groupname, sa.systemname, da.devicenamefrom sensorallocation ra join groupallocation gaon ra.groupid = ga.groupidjoin systemallocation sa on sa.systemid = ra.systemidjoin deviceallocation da on da.deviceid = ra.deviceid[/code]Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2008-03-25 : 22:13:09
|
| thank you harsh_athalye |
 |
|
|
|
|
|
|
|