From: Ian Barwick <barwick@gmx.net>
To: Jakub Ouhrabka <jouh8664@ss1000.ms.mff.cuni.cz>
To: pgsql-sql@postgresql.org
Subject: Re: difficult query
Date: Sat, 4 May 2002 17:44:48 +0200
Message-ID: <200205041744.48054.barwick@gmx.net> (raw)
In-Reply-To: <Pine.LNX.4.33.0205041559440.17441-100000@u-pl2>
References: <Pine.LNX.4.33.0205041559440.17441-100000@u-pl2>
On Saturday 04 May 2002 16:00, Jakub Ouhrabka wrote:
> Hi,
>
> I'd like to ask how to write sql query returning following results without
> using any other table than table1 (e.g. without outer join with table
> containing all possible day numbers...)
(...)
> I'd like to write query returning this:
>
> query results:
> day | number of records for a day
> ----------------------
> 1 | 2
> 2 | 1
> 3 | 0 <--- !!!
> 4 | 2
>
> Is it possible to do this in sql?
Basically, no. (You might be able to do it with the help
of a user-defined function though).
Why do you want to do this?
Ian Barwick
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: barwick@gmx.net, jouh8664@ss1000.ms.mff.cuni.cz
Subject: Re: difficult query
In-Reply-To: <200205041744.48054.barwick@gmx.net>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox