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.

ISQL gives bad count(*)?

2 posts in General Discussion Last posting was on 2002-08-30 14:05:58.0Z
Michael_Russell Posted on 2002-08-30 12:46:44.0Z
From: Michael_Russell
Date: Fri, 30 Aug 2002 08:46:44 -0400
Newsgroups: ianywhere.public.general
Subject: ISQL gives bad count(*)?
Message-ID: <C33645F2FEE796300046325E85256C25.0046327A85256C25@webforums>
Lines: 60
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub ianywhere.public.general:652
Article PK: 2664

This query returns 540767:
select count(*) from runners a left outer join trainers b on a.trainer =
b.trainer where a.trainer = b.trainer

There are 522566 rows in table 'runners'.

I tried:
"select count(*) from runners a left outer join trainers b on a.trainer =
b.trainer where a.trainer = b.trainer"
and received the same result.

The aim is to find 'runners' with a non-matching value for 'trainer', and
this is my first step in that investigation.

The versions:
ASA ISQL 8.0.0 build 2213 and
Sybase Adaptive Server Anywhere Database Engine Version 8.0.0.2213

Probably I'm doing something wrong, but what?
I have included the table descriptions below.

Regards

Michael

/* Table: Runners */
/*==============================================================*/
create table DBA.Runners
(
Race char(8) not null default
NULL,
Horse char(6) not null default
NULL,
Form char(10) default NULL,
CD char(10) default NULL,
Trainer char(5) default NULL,
Jockey char(5) default NULL,
Jock_Allow char(2) default NULL,
Jock_Oweight char(2) default NULL,
Draw char(2) default NULL,
Result_OR char(3) default NULL,
Age char(2) default NULL,
Weight char(3) default NULL,
HeadGear char default NULL,
Penalty char(2) default NULL,
Sex char default NULL,
Finish_Pos char(2) default NULL,
Lens_Btn char(4) default NULL,
SP char(5) default NULL,
Fav char default NULL,
Comment_key char(5) default NULL,
marker char(5) default NULL
)
create table DBA.Trainers
(
Trainer char(5) not null default
NULL,
Tname char(30) default NULL,
marker char(5) default NULL,
Inits char(5) default NULL
);

Trainer is indexed by ttrainer (Trainer)


Michael_Russell Posted on 2002-08-30 14:05:58.0Z
From: Michael_Russell
Date: Fri, 30 Aug 2002 10:05:58 -0400
Newsgroups: ianywhere.public.general
Subject: Re: ISQL gives bad count(*)?
Message-ID: <C4D40580F138FF63004D734B85256C25.0049A1A485256C25@webforums>
References: <C33645F2FEE796300046325E85256C25.0046327A85256C25@webforums>
Lines: 8
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Path: forums-1-dub!forums-master.sybase.com!forums.sybase.com!webforums.sybase.com!news
Xref: forums-1-dub ianywhere.public.general:651
Article PK: 3189

Doh - I suppose the obvious thing is there are duplicate 'trainer' rows ...
sigh ;-)

I'm off to check.

Regards

Michael