From: | Markus Bertheau <twanger(at)bluetwanger(dot)de> |
---|---|
To: | Marco Lazzeri <marcomail(at)noze(dot)it> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Multiple outer join on same table |
Date: | 2004-02-11 21:23:26 |
Message-ID: | 1076534606.1984.8.camel@yarrow.bertheau.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Пнд, 2004-02-09 at 19:12 +0100, Marco Lazzeri wrote:
> Hi!
> I'm searching a better (quicker) way to retrieve data as I used to do
> using the following query...
>
> ==
> SELECT
> main.codice,
> other.value AS value_one,
> other.value AS value_two
> FROM main LEFT OUTER JOIN other ON main.id =
> other.id_main
> LEFT OUTER JOIN other AS other2 ON main.id =
> other2.id_main
> WHERE
> other.type = 'type_one'
> AND other2.type = 'type_two';
> ==
You can alias a table to join it to itself. I'm not sure whether that
answers your question.
SELECT t1.field FROM table AS t1 JOIN table as t2 on (cond)
--
Markus Bertheau <twanger(at)bluetwanger(dot)de>
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Patnude | 2004-02-11 23:33:50 | Re: Unique Constraint with foreign Key |
Previous Message | Mona | 2004-02-11 19:45:12 | unsubscribe |