[thelist] MySQL 5 Query

Fred Jones fredthejonester at gmail.com
Thu Jul 3 06:58:58 CDT 2008

> INNER JOINs would be more appropriate
> you're using a LEFT OUTER JOIN with a WHERE condition on one of the columns
> of the right table
> in effect, this means that you will never return a users row with an
> unmatched profile_values row, because if it were unmatched, then fid would
> be NULL, and then the WHERE condition (fid=1, fid=2) would eliminate that
> row

Ah, I see. Yes, that's not what I want. I will adjust it as you say.

> as for your query, it's fine, although if you need to return other data from
> the profile_values table, i suspect those queries will get messy rather
> quickly

This I understand. Luckily, that's it. :)

>  Dave's guide to the EAV
>  http://weblogs.sqlteam.com/davidm/articles/12117.aspx
>  OTLT and EAV: the two big design mistakes all beginners make
>  http://tonyandrews.blogspot.com/2004/10/otlt-and-eav-two-big-design-mistakes.html

The schema is actually not mine--it's how Drupal 5 stores user profile
fields. :)

Thanks, mate!

More information about the thelist mailing list