| From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
|---|---|
| To: | Lynna Landstreet <lynna(at)spidersilk(dot)net> |
| Cc: | PgSQL-Novice <pgsql-novice(at)postgresql(dot)org> |
| Subject: | Re: Problems with select statement |
| Date: | 2006-01-19 14:55:08 |
| Message-ID: | 20060119064102.T84426@megazone.bigpanda.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-novice |
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?
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Lynna Landstreet | 2006-01-19 19:47:53 | Re: Problems with select statement |
| Previous Message | Lynna Landstreet | 2006-01-19 11:11:36 | Problems with select statement |