On Thu, 19 Jan 2006, Lynna Landstreet wrote:
> OK, this may be just my brain being foggy because it's late at night and
> I've been working on this project too long, but I have a SELECT statement
> that's not doing what I want, and I can't figure out why.
>
> The statement is:
>
> SELECT * FROM users_to_plans p, users u, relation_types r, languages l
> WHERE p.plan_id = [some plan number here]
> AND p.user_id = u.user_id
> AND u.language_id = l.language_id
> AND u.relation_type_id = r.relation_type_id
> ORDER BY u.relation_type_id
What does something like:
select * from
users_to_plans p inner join
users u using (user_id) left join
relation_types r using (relation_type_id) left join
languages l using (language_id)
where p.plan_id = [some plan number here]
order by u.relation_type_id
give you?