Re: how to do 'deep queries'? - Mailing list pgsql-sql

From Anthony Molinaro
Subject Re: how to do 'deep queries'?
Date
Msg-id 3C6C2B281FD3E74C9F7C9D5B1EDA4582182570@wgexch01.wgenhq.net
Whole thread Raw
In response to how to do 'deep queries'?  (jeff sacksteder <jsacksteder@gmail.com>)
Responses Re: how to do 'deep queries'?
Re: how to do 'deep queries'?
List pgsql-sql

that query is 100% correct.

 

it’s just an equijoin (a type of inner join) between 3 tables.

 

the syntax you show is how queries should be written and is more

representative of what a joins between relations really are:

Cartesian products with filters applied

 

the ansi syntax, the explicit JOIN … ON  stuff is (imho) unnecessary,

useful only for outer joins since all the vendors did it differently.

 

what you have will work for postgreSQL, I used the syntax you show in my book

for every single join recipe except for outjoins.

 

are you seeing errors?

 

regards,

  Anthony

-----Original Message-----
From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of jeff sacksteder
Sent:
Monday, September 26, 2005 8:34 PM
To: pgsql-sql@postgresql.org
Subject: [SQL] how to do 'deep queries'?

 

Is there supported syntax to do 'deep' queries? That is where A relates to B relates to C, returning fields from each table?

This doesn't seem to work. Is there a google-able term for this sort of query?

select
   foo.aaa,
   bar.bbb,
   baz.ccc

from
   foo,bar,baz

where
   foo.bar_id = bar.id
and
   bar.baz_id = baz.id


pgsql-sql by date:

Previous
From: "Stewart Ben (RBAU/EQS4) *"
Date:
Subject: Re: how to do 'deep queries'?
Next
From: Tom Lane
Date:
Subject: Re: Why doesn't the SERIAL data type automatically have a UNIQUE CONSTRAINT