🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.database.ado
Article #2039

Re: Wrong RowCount when select distinct

#2039
From: YangKai Liu
Date: Tue, 18 Nov 2003 04:55
36 lines
1983 bytes
The answer should be 4, not 2.

The key lies in the inner join of your SELECT DISTINCT statement.  Should you delete the inner join, I think you will have 2 as the answer.


"xiao zhen" <zhenx@vip.sina.com> wrote:
>Is there no one else meet the same problem?
>Ah.....oh...
>
>"xiao zhen" <zhenx@vip.sina.com> д����Ϣ����
>:3faa11a9$1@newsgroups.borland.com...
>> I am using BCB6 Enterprise + Update4, connect to oracle 8i by ADO.
>>
>> I have 2 tables
>> depts( deptid Number(10) NOT NULL, deptName varchar2(100) )
>> has values ( 1, 'aaa' ), (2, 'bbb')
>>
>> modality( modalityid Number(4) NOT NULL, deptid Number(10) )
>> has values ( 1, 1 ), (2, 1), (3, 2), (4,2)
>>
>> when I use open a TADOQuery object with SQL as
>> "select distinct d.deptid, d.deptname from depts d, modality m where
>> d.deptid = m.deptid"
>>
>> the Query->RowCount is 4, not 2!
>>
>> when I execute the same command by Oracle SQLPlus, result is 2.
>>
>> who can help me?
>>
>>
>>
>>
>
>
Technical Details
Message-ID: <3fb9b44e$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!peernews-us.colt.net!colt.net!peernews3.colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3faa11a9$1@newsgroups.borland.com> <3fab26b0$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: 10698b,a1e498625b8e8d37
X-Google-Attributes: gid10698b,public
X-Google-ArrivalTime: 2003-11-17 22:09:10 PST
From: "YangKai Liu" <yangkai.liu@burkelee.com>
Sender: "YangKai Liu" <yangkai.liu@burkelee.com>
Reply-To: "YangKai Liu" <yangkai.liu@burkelee.com>
Subject: Re: Wrong RowCount when select distinct
Newsgroups: borland.public.cppbuilder.database.ado
X-User-Info: 61.222.26.93     
References: <3faa11a9$1@newsgroups.borland.com> <3fab26b0$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <3fb9b44e$1@newsgroups.borland.com>
Date: 17 Nov 2003 21:55:26 -0700
X-Trace: newsgroups.borland.com 1069134926 207.105.83.66 (17 Nov 2003 21:55:26 -0700)
Lines: 37
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!peernews-us.colt.net!colt.net!peernews3.colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail