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.

Query question

4 posts in General Discussion Last posting was on 2005-05-03 15:27:23.0Z
Michael Posted on 2005-04-28 10:31:55.0Z
Sender: 47b6.4270ba10.1804289383@sybase.com
From: Michael
Newsgroups: ianywhere.public.general
Subject: Query question
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4270bb96.47c4.1681692777@sybase.com>
X-Original-NNTP-Posting-Host: 10.22.241.42
X-Original-Trace: 28 Apr 2005 03:31:50 -0700, 10.22.241.42
Lines: 21
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 28 Apr 2005 03:31:53 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 28 Apr 2005 03:31:55 -0700
X-Trace: forums-1-dub 1114684315 10.22.108.75 (28 Apr 2005 03:31:55 -0700)
X-Original-Trace: 28 Apr 2005 03:31:55 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4395
Article PK: 8208

I need a query help to get invalid down/up status from
records :

9:30 Up
9:31 Down
9:35 Down
9:38 Up
9:41 Down
9:55 Up
9:59 Up

And here is the expecting result :
9:31 Down
9:35 Down
9:55 Up
9:59 Up

Thanks for help.


Michael


Joshua Savill Posted on 2005-04-28 13:55:59.0Z
From: "Joshua Savill" <jsavill@ianywhere.com>
Newsgroups: ianywhere.public.general
References: <4270bb96.47c4.1681692777@sybase.com>
Subject: Re: Query question
Lines: 38
Organization: iAnywhere Solutions
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: jsavill-pc.sybase.com
X-Original-NNTP-Posting-Host: jsavill-pc.sybase.com
Message-ID: <4270eb6f$1@forums-1-dub>
Date: 28 Apr 2005 06:55:59 -0700
X-Trace: forums-1-dub 1114696559 10.25.98.205 (28 Apr 2005 06:55:59 -0700)
X-Original-Trace: 28 Apr 2005 06:55:59 -0700, jsavill-pc.sybase.com
X-Authenticated-User: techsupp
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4399
Article PK: 8211

Michael,

Please always include the version and build of ASA (this can be determine by
running dbeng9 -v).

Can you provide more details about the schema of the table you are trying to
query and what you are trying to accomplish.

Thanks,

--
Joshua Savill
iAnywhere Solutions - Product Support Analyst

<Michael> wrote in message news:4270bb96.47c4.1681692777@sybase.com...
>I need a query help to get invalid down/up status from
> records :
>
> 9:30 Up
> 9:31 Down
> 9:35 Down
> 9:38 Up
> 9:41 Down
> 9:55 Up
> 9:59 Up
>
> And here is the expecting result :
> 9:31 Down
> 9:35 Down
> 9:55 Up
> 9:59 Up
>
> Thanks for help.
>
>
> Michael


Breck Carter Posted on 2005-04-28 18:24:22.0Z
Sender: 4d7b.4271101b.1804289383@sybase.com
From: Breck Carter
Newsgroups: ianywhere.public.general
Subject: Re: Query question
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <42712a52.50b1.1681692777@sybase.com>
References: <4270bb96.47c4.1681692777@sybase.com>
X-Original-NNTP-Posting-Host: 10.22.241.42
X-Original-Trace: 28 Apr 2005 11:24:18 -0700, 10.22.241.42
Lines: 53
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 28 Apr 2005 11:24:19 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 28 Apr 2005 11:24:22 -0700
X-Trace: forums-1-dub 1114712662 10.22.108.75 (28 Apr 2005 11:24:22 -0700)
X-Original-Trace: 28 Apr 2005 11:24:22 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4407
Article PK: 8215

CREATE TABLE status (
pkey INTEGER NOT NULL DEFAULT AUTOINCREMENT,
status_time TIME NOT NULL,
status VARCHAR ( 4 ) NOT NULL,
PRIMARY KEY ( pkey ) );

INSERT status ( status_time, status ) VALUES ( '9:30', 'Up'
);
INSERT status ( status_time, status ) VALUES ( '9:31',
'Down' );
INSERT status ( status_time, status ) VALUES ( '9:35',
'Down' );
INSERT status ( status_time, status ) VALUES ( '9:38', 'Up'
);
INSERT status ( status_time, status ) VALUES ( '9:41',
'Down' );
INSERT status ( status_time, status ) VALUES ( '9:55', 'Up'
);
INSERT status ( status_time, status ) VALUES ( '9:59', 'Up'
);
COMMIT;

SELECT this.*
FROM status AS this
LEFT OUTER JOIN status AS prior
ON prior.pkey = this.pkey - 1
LEFT OUTER JOIN status AS next
ON next.pkey = this.pkey + 1
WHERE this.status = prior.status
OR this.status = next.status
ORDER BY this.status_time;

> I need a query help to get invalid down/up status from
> records :
>
> 9:30 Up
> 9:31 Down
> 9:35 Down
> 9:38 Up
> 9:41 Down
> 9:55 Up
> 9:59 Up
>
> And here is the expecting result :
> 9:31 Down
> 9:35 Down
> 9:55 Up
> 9:59 Up
>
> Thanks for help.
>
>
> Michael


Michael Posted on 2005-05-03 15:27:23.0Z
Sender: 118d.42761451.1804289383@sybase.com
From: Michael
Newsgroups: ianywhere.public.general
Subject: Re: Query question
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <42779859.276b.1681692777@sybase.com>
References: <42712a52.50b1.1681692777@sybase.com>
X-Original-NNTP-Posting-Host: 10.22.241.42
X-Original-Trace: 3 May 2005 08:27:21 -0700, 10.22.241.42
Lines: 63
X-Original-NNTP-Posting-Host: forums-2-dub.sybase.com
X-Original-Trace: 3 May 2005 08:27:22 -0700, forums-2-dub.sybase.com
NNTP-Posting-Host: forums-master.sybase.com
X-Original-NNTP-Posting-Host: forums-master.sybase.com
Date: 3 May 2005 08:27:23 -0700
X-Trace: forums-1-dub 1115134043 10.22.108.75 (3 May 2005 08:27:23 -0700)
X-Original-Trace: 3 May 2005 08:27:23 -0700, forums-master.sybase.com
X-Authenticated-User: ngsysop
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:4435
Article PK: 8244

Thanks for help Breck.
Last issue, unfortunatelly my table's structure is :
Trx_Time DateTime and Status Varchar(3)

I think your query won't works since it needs Pkey for make
relation.
Could you please give me other solution?


Michael

> CREATE TABLE status (
> pkey INTEGER NOT NULL DEFAULT AUTOINCREMENT,
> status_time TIME NOT NULL,
> status VARCHAR ( 4 ) NOT NULL,
> PRIMARY KEY ( pkey ) );
>
> INSERT status ( status_time, status ) VALUES ( '9:30',
> 'Up' );
> INSERT status ( status_time, status ) VALUES ( '9:31',
> 'Down' );
> INSERT status ( status_time, status ) VALUES ( '9:35',
> 'Down' );
> INSERT status ( status_time, status ) VALUES ( '9:38',
> 'Up' );
> INSERT status ( status_time, status ) VALUES ( '9:41',
> 'Down' );
> INSERT status ( status_time, status ) VALUES ( '9:55',
> 'Up' );
> INSERT status ( status_time, status ) VALUES ( '9:59',
> 'Up' );
> COMMIT;
>
> SELECT this.*
> FROM status AS this
> LEFT OUTER JOIN status AS prior
> ON prior.pkey = this.pkey - 1
> LEFT OUTER JOIN status AS next
> ON next.pkey = this.pkey + 1
> WHERE this.status = prior.status
> OR this.status = next.status
> ORDER BY this.status_time;
>
> > I need a query help to get invalid down/up status from
> > records :
> >
> > 9:30 Up
> > 9:31 Down
> > 9:35 Down
> > 9:38 Up
> > 9:41 Down
> > 9:55 Up
> > 9:59 Up
> >
> > And here is the expecting result :
> > 9:31 Down
> > 9:35 Down
> > 9:55 Up
> > 9:59 Up
> >
> > Thanks for help.
> >
> >
> > Michael