Re: EXTERN JOIN with WHEN query - Mailing list pgsql-general

From scott.marlowe
Subject Re: EXTERN JOIN with WHEN query
Date
Msg-id Pine.LNX.4.33.0306060834500.19717-100000@css120.ihs.com
Whole thread Raw
In response to EXTERN JOIN with WHEN query  (javier garcia - CEBAS <rn001@cebas.csic.es>)
List pgsql-general
On Thu, 5 Jun 2003, javier garcia - CEBAS wrote:

> Hi all;
> This is a query that I guess is not very difficult, but I'm a newbie;
> I've got a lot of tables, each of them with two columns:
>
> SELECT * FROM precal; ->
>   (date)     (real)
>    fecha    | precipitacion
> ------------+---------------
>  1996-01-01 |             0.6
>  1996-02-01 |             0.7
> ...
>
>
> But in this table there are some inexistents records (some missing days)
> And I would like to create lists with a full list of dates and corresponding
> precipitation data, with gaps when the row didn't exist.
> So; I've created a table with a complete series of dates from 1950 up to
> date, and made the query:

Any time you're gonna do this, you can make a table with all the dates in
it already, and left join against that.

I.e. if you want a report for every month, numbered 1 through 12, then
just create a table with an id 1 to 12 and the names of the months.  Since
the table's so small, it doesn't even really need indexes.


pgsql-general by date:

Previous
From: "Henrik Steffen"
Date:
Subject: update phenomenon
Next
From: Dmitry Tkach
Date:
Subject: Re: Nulls get converted to 0 problem