Re: [GENERAL] How do you live without OUTER joins? - Mailing list pgsql-general

From Alain TESIO
Subject Re: [GENERAL] How do you live without OUTER joins?
Date
Msg-id 002401bf5c99$e35344a0$f05f72c3@atesio
Whole thread Raw
In response to How do you live without OUTER joins?  ("Bruce Bantos" <anon@mgfairfax.rr.com>)
List pgsql-general
It's maybe not the best solution, what I usually is :

- Copy the lines you want from company into a temporary
  table tmp, with "com_cat_long" added with the right type,
  initialized with NULL
- Update this column in tmp from company_category
- Select from tmp
- Drop tmp

Or maybe :

select company_name,com_cat_long from  company,company_category where ...
union
select company_name,NULL as com_cat_long from company where
com_cat_abbr=NULL

I'm not sure about the syntax for the second one, sorry I can't try it now.

Alain


> For example, how can I live without outer joins in the example below:
>
> In my current Oracle DB, I have a number of "lookup" tables that contain
> something like this:
>
> TABLE company_category:
>
> com_cat_abbr    |    com_cat_long
> --------------------------------------------------
> SB                    |    Small Business
> LB                    |    Large Business
> NP                    |    Not for Profit
>
> etc.
>
> Then in my main table, lets say the "company" table I have:
>
> company_name     |        com_cat_abbr
> ------------------------------------------------------------
> Microsoft              |        LB
> United Way           |        NP
> Coca Cola            |        NULL
>
> What are my alternatives? What is everyone else doing in their Postgres
> system? Thanks.



pgsql-general by date:

Previous
From: "Bruce Bantos"
Date:
Subject: How do you live without OUTER joins?
Next
From: Peter Eisentraut
Date:
Subject: Re: [GENERAL] Where is my database gone ?