Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: GROUP BY query in Oracle

Re: GROUP BY query in Oracle

From: André Klück <akluck01_at_wxs.nl>
Date: Sun, 15 Aug 1999 21:57:52 +0200
Message-ID: <37B71BC0.6C2A@wxs.nl>


Zile,

Aparantly your question is not put precize enough. Define exactly what you want: for instance - any ssn per minimum and maximum date per month - any ssn per minimum and maximum date
Remember you can do the folllowing if not the complete question is to be put in one single SQL-statement:
SELECT x,y,z
FROM
UNION ALL
SELECT a,b,c
FROM
GROUP BY 1 m.vr.gr.,
André

>
> Could anyone tell me how to group dates that are in sequence?
>
> My data looks like the following:
>
> 111-11-1111 1/1/99
> 111-11-1111 1/2/99
> 111-11-1111 1/3/99
> 111-11-1111 2/1/99
> 111-11-1111 2/2/99
> 111-11-1111 2/3/99
> 222-22-2222 1/1/99
> 222-22-2222 1/2/99
> 222-22-2222 1/3/99
>
> When I used the following statement:
>
> SELECT ssn, MIN(date_field), MAX(date_field) FROM tbl GROUP BY ssn
>
> It returned
> 111-11-1111 1/1/99 2/3/99
> 222-22-2222 1/1/99 1/3/99
>
> I would actually like to get 3 records back as the following:
> 111-11-1111 1/1/99 1/3/99
> 111-11-1111 2/1/99 2/3/99
> 222-22-2222 1/1/99 1/3/99
>
> Could anyone tell me if it is possible?
>
> Thanks alot!!!!!
>
> Zile Liao
> zliao_at_lbisoft.com
Received on Sun Aug 15 1999 - 14:57:52 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US