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 |
|
mike241982
Starting Member
2 Posts |
Posted - 2012-07-16 : 15:47:21
|
| Hello,I'm pretty new to SQL and I have the following:SELECT COL1, COL2, COL3 FROM TABLE1 INNER JOIN TABLE2 ON TABLE1.COL1 = TABLE2.COL1 WHERE TABLE3.COL1 = 'example' First 3 lines work, but when I add the WHERE statement at the end, it doesn't work.Basically I need to do the following:1) Get from table3 everything from col1 that says 'example'2) From that result, I need to get the col1, col2, col3 from table 1 IF table1.col1 = table2.col1Thanks! |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
mike241982
Starting Member
2 Posts |
Posted - 2012-07-16 : 16:05:03
|
| How would I add another INNER JOIN?SELECT COL1, COL2, COL3FROM TABLE1 INNER JOIN TABLE2 AND TABLE3ON TABLE1.COL1 = TABLE2.COL1WHERE TABLE3.COL1 = 'example' orSELECT COL1, COL2, COL3FROM TABLE1 INNER JOIN TABLE2 ON TABLE1.COL1 = TABLE2.COL1FROM TABLE2 INNER JOIN TABLE3WHERE TABLE3.COL1 = 'example'Neither seems to be working for me but adding another inner join makes sense.If you can provide an example that'd be great!Thanks |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|
|
|