MS SQL Server Concepts and Programming Question: Download MS SQL Server PDF
How To Write an Inner Join with the WHERE Clause in MS SQL Server?
Answer:
If you don't want to use the INNER JOIN ... ON clause to write an inner join, you can put the join condition in the WHERE clause as shown in the following query example:
SELECT l.id, l.url, r.comment
FROM ggl_links l, ggl_rates r WHERE l.id = r.id
GO
<pre>
id url comment
101 www.globalguideline.com The best
102 www.globalguideline.com/html Well done
103 www.globalguideline.com/sql Thumbs up</pre>
SELECT l.id, l.url, r.comment
FROM ggl_links l, ggl_rates r WHERE l.id = r.id
GO
<pre>
id url comment
101 www.globalguideline.com The best
102 www.globalguideline.com/html Well done
103 www.globalguideline.com/sql Thumbs up</pre>
Previous Question | Next Question |
How To Write a Query with a Full Outer Join in MS SQL Server? | How To Name Query Output Columns in MS SQL Server? |