Re: Problems with select statement - Mailing list pgsql-novice

From Stephan Szabo
Subject Re: Problems with select statement
Date
Msg-id 20060119123234.M31364@megazone.bigpanda.com
Whole thread Raw
In response to Re: Problems with select statement  (Lynna Landstreet <lynna@spidersilk.net>)
Responses Re: Problems with select statement  (Lynna Landstreet <lynna@spidersilk.net>)
List pgsql-novice
On Thu, 19 Jan 2006, Lynna Landstreet wrote:

> On 1/19/06 9:55 AM, Stephan Szabo <sszabo@megazone.bigpanda.com> wrote:
>
> > 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?
>
> Yay! That worked perfectly! Thank you!

Okay, if that works, that probably implies that some of the users aren't
matching up with relation_types or languages. Are you getting NULL outputs
for the r and/or l columns for the people that were missing before?

> I really need to read up on the different kinds of joins.  I'm still not
> clear on how all that works. I've done queries across multiple tables, but
> only in the fairly simple form that was in my previous e-mail, which
> obviously is not suitable for all situations.

There's a little information in the documentation for SELECT about the
different types.

> The one PostgreSQL book I have ("Beginning Databases with PostgreSQL" by
> Richard Stones and Neil Matthew) doesn't go into a lot of detail on them -
> would you happen to know of any online tutorials about that sort of thing?

I don't know how good they are, but...
http://www.devx.com/dbzone/Article/17403/0/page/1
http://www.w3schools.com/sql/sql_join.asp

pgsql-novice by date:

Previous
From: Lynna Landstreet
Date:
Subject: Re: Problems with select statement
Next
From: Frank Bax
Date:
Subject: Re: Problems with select statement