Re: SQL syntax - Mailing list pgsql-sql

From Tod McQuillin
Subject Re: SQL syntax
Date
Msg-id 20020807014416.F3278-100000@glass.pun-pun.prv
Whole thread Raw
In response to SQL syntax  (frederic massot <frederic@juliana-multimedia.com>)
List pgsql-sql
On Tue, 6 Aug 2002, frederic massot wrote:

> And I try to obtain for one month given (for example August : 8) two
> previous months, the current month, and nine next months :
>
>
> id_mois|mois_fr  |mois_en  |mois_de
> -------+---------+---------+---------
>       6|Juin     |June     |Juni
>       7|Juillet  |July     |Juli
>       8|Aout     |August   |August
>       9|Septembre|September|September
>      10|Octobre  |October  |Oktober
>      11|Novembre |November |November
>      12|Decembre |December |Dezember
>       1|Janvier  |January  |Januar
>       2|Fevrier  |February |Februar
>       3|Mars     |March    |Marz
>       4|Avril    |April    |April
>       5|Mai      |May      |Aber
>
> Do you see how making in a SQL request ?

given m = 8:

select * from mois
order by case when id_mois < (m + 10) % 12 then id_mois + 13 else id_mois
end;

-- 
Tod McQuillin




pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: problem fetching currval of sequence
Next
From: Bruno Wolff III
Date:
Subject: Re: Transitive Closure