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

From Stewart Ben (RBAU/EQS4) *
Subject Re: how to do 'deep queries'?
Date
Msg-id E253BDD7F008244585AEE87AF8F0224F116C7A6A@cl-mail01.au.bosch.com
Whole thread Raw
In response to how to do 'deep queries'?  (jeff sacksteder <jsacksteder@gmail.com>)
List pgsql-sql
> 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

This works for me..

SELECT table1.state, table2.coursename, table3.firstname FROM backend.enrolments table1, backend.courses table2,
backend.users
table3WHERE table1.user = table3.employeeno  AND table1.course = table2.courseid;

What errors are you getting?

Best regards,

Ben Stewart

--
Robert Bosch (Australia) Pty. Ltd.
Engineering Quality Services, Student Software Engineer (RBAU/EQS4)
Locked Bag 66 - Clayton South, VIC 3169 - AUSTRALIA
Tel: +61 3 9541-7002 Fax: +61 3 9541-7700
mailto:ben.stewart@au.bosch.com
http://www.bosch.com.au/


pgsql-sql by date:

Previous
From: Ferindo Middleton Jr
Date:
Subject: Why doesn't the SERIAL data type automatically have a UNIQUE CONSTRAINT
Next
From: "Anthony Molinaro"
Date:
Subject: Re: how to do 'deep queries'?