SQLTeam.com | Weblogs | Forums

Conditions within left join

Hello all, I don't think i need to post the entire query but simply have a question about using a conditoinal statement within a left join.

There can be multiple rows per person in an address table, with a value of '1' in the field signifying his current address; all other records contain '0' denoting previous addresses.

I want to return all the other data in my query regardless. Including the condition in the WHERE clause is not an option, so I'm placing it in the left join, but rows are not returning when I should.

  left JOIN table1 l on f.ecsoid = l.ecsoid and l.CURRENTADD = '1'

Should not this work?

Thanks so much for your help.

Looks like it should work, assuming the JOIN is otherwise correct.

Are you doing any WHERE conditions against the l / table1 table?

Thanks Scott. That was the problem.