Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

SQL - Grouping problem

3 posts in General Discussion Last posting was on 2004-12-22 16:49:52.0Z
Robin Posted on 2004-12-22 08:28:45.0Z
From: "Robin" <.@iol.it>
Newsgroups: ianywhere.public.general
Subject: SQL - Grouping problem
Lines: 54
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
X-Original-NNTP-Posting-Host: 83.103.21.222
Message-ID: <41c93039$1@forums-2-dub>
X-Original-Trace: 22 Dec 2004 00:28:41 -0800, 83.103.21.222
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 22 Dec 2004 00:28:42 -0800, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 22 Dec 2004 00:28:45 -0800
X-Trace: forums-1-dub 1103704125 10.22.108.75 (22 Dec 2004 00:28:45 -0800)
X-Original-Trace: 22 Dec 2004 00:28:45 -0800, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4005
Article PK: 7897

I have a table like tihis one:

DATE CONDITION
2004-01-13 100
2004-02-01 100
2004-04-01 90
2004-04-20 90
2004-04-22 100
2004-05-21 100
2004-06-06 110
2004-07-28 110

I'd like to obtain a grouping like this one...

DATE_FROM DATE_TO CONDITION
2004-01-13 2004-02-01 100
2004-04-01 2004-04-20 90
2004-04-22 2004-05-21 100
2004-06-06 2004-07-28 110

...or alternatively like this one.

DATE_FROM CONDITION
2004-01-13 100
2004-04-01 90
2004-04-22 100
2004-06-06 110

With this query:

select min(DATE) as DATE_FROM ,max(DATE) as DATE_TO,CONDITION
from TABLE
group by CONDITION
order by DATE_FROM ,DATE_TO
...I don't reach the aim because the result is:

DATE_FROM DATE_TO CONDITION
2004-01-13 2004-05-21 100 <<<
2004-04-01 2004-04-20 90
2004-06-06 2004-07-28 110

Notice that there is only a "100" condition.

Does anybody know a short way to obtain the grouping requested.

Thank you in advance.

Best wishes.

robin

I use ASA 6.0.3 (for now)


Chris Keating (iAnywhere Solutions) Posted on 2004-12-22 14:08:07.0Z
From: "Chris Keating \(iAnywhere Solutions\)" <Spam_NoThanks_keating@iAnywhere.com>
Newsgroups: ianywhere.public.general
References: <41c93039$1@forums-2-dub>
Subject: Re: SQL - Grouping problem
Lines: 59
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: keating-xp2.sybase.com
X-Original-NNTP-Posting-Host: keating-xp2.sybase.com
Message-ID: <41c97fc7$1@forums-1-dub>
Date: 22 Dec 2004 06:08:07 -0800
X-Trace: forums-1-dub 1103724487 10.25.98.199 (22 Dec 2004 06:08:07 -0800)
X-Original-Trace: 22 Dec 2004 06:08:07 -0800, keating-xp2.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4006
Article PK: 7896

Please do not crosspost.

"Robin" <.@iol.it> wrote in message news:41c93039$1@forums-2-dub...
>I have a table like tihis one:
>
> DATE CONDITION
> 2004-01-13 100
> 2004-02-01 100
> 2004-04-01 90
> 2004-04-20 90
> 2004-04-22 100
> 2004-05-21 100
> 2004-06-06 110
> 2004-07-28 110
>
> I'd like to obtain a grouping like this one...
>
> DATE_FROM DATE_TO CONDITION
> 2004-01-13 2004-02-01 100
> 2004-04-01 2004-04-20 90
> 2004-04-22 2004-05-21 100
> 2004-06-06 2004-07-28 110
>
> ...or alternatively like this one.
>
> DATE_FROM CONDITION
> 2004-01-13 100
> 2004-04-01 90
> 2004-04-22 100
> 2004-06-06 110
>
> With this query:
>
> select min(DATE) as DATE_FROM ,max(DATE) as DATE_TO,CONDITION
> from TABLE
> group by CONDITION
> order by DATE_FROM ,DATE_TO
> ...I don't reach the aim because the result is:
>
> DATE_FROM DATE_TO CONDITION
> 2004-01-13 2004-05-21 100 <<<
> 2004-04-01 2004-04-20 90
> 2004-06-06 2004-07-28 110
>
> Notice that there is only a "100" condition.
>
> Does anybody know a short way to obtain the grouping requested.
>
> Thank you in advance.
>
> Best wishes.
>
> robin
>
> I use ASA 6.0.3 (for now)
>
>


Robin Posted on 2004-12-22 16:49:52.0Z
From: "Robin" <.@iol.it>
Newsgroups: ianywhere.public.general
References: <41c93039$1@forums-2-dub> <41c97fc7$1@forums-1-dub>
Subject: Re: SQL - Grouping problem
Lines: 68
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 83.103.21.222
X-Original-NNTP-Posting-Host: 83.103.21.222
Message-ID: <41c9a5b0@forums-1-dub>
Date: 22 Dec 2004 08:49:52 -0800
X-Trace: forums-1-dub 1103734192 83.103.21.222 (22 Dec 2004 08:49:52 -0800)
X-Original-Trace: 22 Dec 2004 08:49:52 -0800, 83.103.21.222
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4007
Article PK: 7900

You are true. I apologize but I mistook the newsgroup.

I'm sorry.

Regards.

"Chris Keating (iAnywhere Solutions)" <Spam_NoThanks_keating@iAnywhere.com> ha scritto nel messaggio news:41c97fc7$1@forums-1-dub...

> Please do not crosspost.
>
> "Robin" <.@iol.it> wrote in message news:41c93039$1@forums-2-dub...
> >I have a table like tihis one:
> >
> > DATE CONDITION
> > 2004-01-13 100
> > 2004-02-01 100
> > 2004-04-01 90
> > 2004-04-20 90
> > 2004-04-22 100
> > 2004-05-21 100
> > 2004-06-06 110
> > 2004-07-28 110
> >
> > I'd like to obtain a grouping like this one...
> >
> > DATE_FROM DATE_TO CONDITION
> > 2004-01-13 2004-02-01 100
> > 2004-04-01 2004-04-20 90
> > 2004-04-22 2004-05-21 100
> > 2004-06-06 2004-07-28 110
> >
> > ...or alternatively like this one.
> >
> > DATE_FROM CONDITION
> > 2004-01-13 100
> > 2004-04-01 90
> > 2004-04-22 100
> > 2004-06-06 110
> >
> > With this query:
> >
> > select min(DATE) as DATE_FROM ,max(DATE) as DATE_TO,CONDITION
> > from TABLE
> > group by CONDITION
> > order by DATE_FROM ,DATE_TO
> > ...I don't reach the aim because the result is:
> >
> > DATE_FROM DATE_TO CONDITION
> > 2004-01-13 2004-05-21 100 <<<
> > 2004-04-01 2004-04-20 90
> > 2004-06-06 2004-07-28 110
> >
> > Notice that there is only a "100" condition.
> >
> > Does anybody know a short way to obtain the grouping requested.
> >
> > Thank you in advance.
> >
> > Best wishes.
> >
> > robin
> >
> > I use ASA 6.0.3 (for now)
> >
> >
>
>