Re: how to do 'deep queries'?

From: "Stewart Ben (RBAU/EQS4) *" <Ben(dot)Stewart(at)au(dot)bosch(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: how to do 'deep queries'?
Date: 2005-09-27 00:45:13
Message-ID: E253BDD7F008244585AEE87AF8F0224F116C7A6A@cl-mail01.au.bosch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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
table3
WHERE 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(dot)stewart(at)au(dot)bosch(dot)com
http://www.bosch.com.au/

Browse pgsql-sql by date

  From Date Subject
Next Message Ferindo Middleton Jr 2005-09-27 00:45:18 Why doesn't the SERIAL data type automatically have a UNIQUE CONSTRAINT
Previous Message jeff sacksteder 2005-09-27 00:34:14 how to do 'deep queries'?