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 |
|
eprices
Starting Member
4 Posts |
Posted - 2007-05-25 : 19:02:26
|
I'm new to SQL Server 2005 and have a question that I know is very basic but that has confounded me for a while: An example of a SQL query that would accomplish this would be greatly appreciated.Thanks :) |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-05-25 : 19:09:00
|
| You would use an inner join.SELECT t1.a, t2.bFROM Table1 t1INNER JOIN table2 t2ON t1.a = t2.aORDER BY t2.bTara Kizerhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
eprices
Starting Member
4 Posts |
Posted - 2007-05-25 : 19:12:45
|
| thank youthank youthank you |
 |
|
|
eprices
Starting Member
4 Posts |
Posted - 2007-05-25 : 19:31:27
|
To take this one step further, if I have four tables... Again, thank you so much for your help |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-05-25 : 19:40:23
|
| Then you would add more joins to your query.Doesn't your class material or your SQL book have examples of this?Tara Kizerhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-05-25 : 19:41:09
|
basically you just INNER JOIN to the additional tables.select t2.Name, t3.City, t4.Statefrom t1 inner join t2 on t1.NameID = t2.NameIDinner join t3 on t1.CityID = t3.CityIDinner join t4 on t1.StateID = t4.StateID KH |
 |
|
|
eprices
Starting Member
4 Posts |
Posted - 2007-05-25 : 19:49:03
|
quote: Originally posted by khtan
Thank you very much |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|