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-04-02 : 02:37:11
|
| hi,i have a table(Measurement) with the following columns SensorId,Maximumvalue,MinimumValue,GroupId,SystemId,DeviceId.so in the above column SensorId is ForeignKey of the Table Sensor which havs two columns(SensorId,SensorName)so in the above column GRoupId is ForeignKey of the Table Group which havs two columns(GroupId,GroupName)SystemId is ForeignKey of the Table System which havs two columns(SystemId,SystemName)DeviceId is ForeignKey of the Table Device which havs two columns(DeviceId,DeviceName)so my result should be as like as follows:SensorId,SensorName,Maximumvalue,MinimumValue,GroupName,SystemName,DeviceName.instesd of displaysing GroupId, SystemId,DeviceId i need to diplay the SensorName,GroupName,SystemName,DeviceName. so please give me some example query to join multiple tables please |
|
|
pravin14u
Posting Yak Master
246 Posts |
Posted - 2008-04-02 : 02:44:11
|
| Select M.SensorId,S.SensorName,M.Maximumvalue,M.MinimumValue,G.GroupName,S1.SystemName,D.DeviceNameFrom Measurement MINNER JOIN Sensor S on M.SensorId=S.SensorIdINNER JOIN Group G on M.GroupId=G.GroupIdINNER JOIN Device D on M.DeviceID=D.DeviceIdINNER JOIN System S1 on M.SystemID=S1.SystemIDPrakash.PThe secret to creativity is knowing how to hide your sources! |
 |
|
|
sqllover
Constraint Violating Yak Guru
338 Posts |
Posted - 2008-04-02 : 02:54:22
|
| hi Prakash,Thanks a lot for repy. |
 |
|
|
|
|
|
|
|