Using management studio for SQL Server 2008 R2.
SQL Server 2008 R2
Trying to do a LEFT JOIN and I need to return all rows from the first table regardless of t
LEFT JOIN
Move the b condition from WHERE to ON to get a real LEFT JOIN. (With the b condition in the WHERE clause, it executes as a regular inner join...)
WHERE
ON
inner join
select a.id, a.name, b.store, b.stock from products a left join stock b on a.id = b.id and b.store = '001' order by a.id