MySQL LEFT JOIN Problem - Missing LEFT column?

Try moving the profile values conditions to the JOIN statement: SELECT pf. `id`, pf. `name`, pv.

`value` FROM `profile_fields` AS pf LEFT JOIN `profile_values` AS pv ON ( pf. `id` = pv. `field_id` AND (pv.

`user_id` = '%d' OR pv. `user_id` IS NULL) ) WHERE (pf. `site_id` = '0' OR pf.

`site_id` = '%d') ORDER BY pf. `order` ASC.

Many thanks - that did the trick! Never knew I was able to add that sort of thing in an "ON" clause! – Nick Dec 2 '08 at 12:36 Shouldn't the ... OR ... pv.

User_id IS NULL) part of the original query take care of showing the profile_fields without all optional profile_values available? – Ruben Dec 2 '08 at 12:37 That's what I thought, but it didn't for some reason. It works with Eran's code however, so I probably put it in the wrong place.

– Nick Dec 2 '08 at 12:46 You can probably get rid of the 'OR pv. User_id IS NULL' after you move the condition into the join condition. – Bill Karwin Dec 2 '08 at 14:42 what is that "%d"?

– bbtang Dec 2 '087 at 4:50.

LEFT JOIN `profile_values` AS pv ON (pf. `site_id` = '0' OR pf. `site_id` = '%d') AND (pv.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions