Re: Query

From: Peter Nilsson <airia_at_acay.com.au>
Date: Mon, 29 Sep 2008 21:54:51 -0700 (PDT)
Message-ID: <6316f3b0-2293-43bf-9931-50ab7a9532c1@a70g2000hsh.googlegroups.com>


m..._at_adlineservices.com wrote:
> "Michel Cadot" <micadot{at}altern{dot}org> wrote:
> > Just use add_months(...,-18) and an ORDER BY start_date
> > and the date will be grouped.
>
> Well, I was wondering how to get it into 3 groups:
>
> 1-6 months
> 6-12 months
> 12-18 months
>
> I mean, it is not a program with a loop or anything.
> Maybe some sort of Pivot table?  I've read a bit about
> those......

  select n,

         case
           when n between 1 and 3 then '1..3'
           when n between 4 and 6 then '4..6'
           when n between 7 and 9 then '7..9'
         end grp

    from (select mod(level, 17) n from dual connect by level <= 100)    where n between 1 and 9;
--
Peter
Received on Mon Sep 29 2008 - 23:54:51 CDT

Original text of this message