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 |
|
cutepraba
Yak Posting Veteran
53 Posts |
Posted - 2007-12-18 : 03:29:56
|
| I have four tables. now i need to select the rows from all the four tables.TABLE1: -JobjobnomtidpridmtpathprpathTABLE2: - livestaff this id will be store in JobstaffidstaffnameteamidactiveTABLE3: -masterstaffmstaffidstaffnameteamidactiveTABLE4: -staffrelmasterstaffidlivestaffidNow i need to select * from job and staffname from masterstaff and teamid from livestaff.Please help____________Praba |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-12-18 : 03:33:42
|
| Join tables with key columns and select required columns from respective tablesMadhivananFailing to plan is Planning to fail |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2007-12-18 : 04:14:19
|
something like:-SELECT j.*,m.staffname,l.teamidFROM Job jINNER JOIN livestaff lON l.staffid=j.{corresponding id column}INNER JOIN staffrel sON s.livestaffid=l.staffidINNER JOIN masterstaff mON m.mstaffid=s.masterstaffidlearn more on joins from here:-[url]http://msdn2.microsoft.com/en-us/library/ms190014.aspx[/url] |
 |
|
|
|
|
|