вторник, 25 септември 2007 г.

Sql LEFT JOIN "problem". (Does not returns results)

Select x.*, y.one, y.two
From x left join y on x.someid = x.someid

works fine

but

Select x.*, y.one, y.two
From x left join y on x.someid = x.someid
Where y=somevalue

does not work.

The solution is simple. Move where clause in join clause
Select x.*, y.one, y.two
From x left join y on x.someid = x.someid and y=somevalue

Няма коментари: