UNION or UNION ALL

From: Abdul Wahab Dahalan <wahab(at)mimos(dot)my>
To: pgsql-sql(at)postgresql(dot)org
Subject: UNION or UNION ALL
Date: 2003-02-13 08:52:19
Message-ID: 3E4B5CC3.2C10E63A@mimos.my
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I've 3 tables A,B,C
records in table A like:
id name
b1 abc
b2 xyz
b3 rst

records in table B like:
id type
b1 logistics
b1 importer
b2 logistics
b3 logistics
b3 exporter

records in table C like:
id offer title
b1 sell car
b1 buy car
b1 sell van
b2 sell car

How shoul I do a query so that I can get a result like
(The query will be based on B.type ='logistics')
id name offer
b1 abc sell
b1 abc buy
b1 abc sell
b2 xyz sell
b3 rst --

Any help very much appricated

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tomasz Myrta 2003-02-13 09:21:35 Re: SQL Functions vs PL/PgSQL
Previous Message Frankie Lam 2003-02-13 07:25:44 Re: dblink question please