Sorry if the question is too basic, I’m teaching myself TSQL and I don’t know how the following is done:
I have this query:
SELECT table1.name, table2.city AS city, table2.province
FROM table1 LEFT OUTER JOIN table2
ON table1.id = table2.id
WHERE table1.name NOT LIKE 'test'
ORDER BY city DESC
And I want to add to it this other one:
SELECT table3.country
FROM table3 LEFT JOIN table2
ON table3.id = table2.id
WHERE table2.city = city
So I can have this result:
name — city — province — country
How can I do so?
Thanks a lot!
Simply use two joins in one SQL statement:
(Sorry guys, I didn’t have time to check it, thanks for the comment. Code is revised.)