🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Wrong RowCount when select distinct

#2041
From: YangKai Liu
Date: Tue, 18 Nov 2003 09:29
43 lines
2208 bytes
My mistake, my program did not include the distinct...
Anyway, my answer with SQL server is 2.By the way,
how can you use rowcount with tadoquery?  my answer is from recordcount...

"YangKai Liu" <yangkai.liu@burkelee.com> wrote:
>
>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: <3fb9f473$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.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> <3fb9b44e$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-18 02:39:21 PST
From: "YangKai Liu" <yangkailiu@burkelee.com>
Sender: "YangKai Liu" <yangkailiu@burkelee.com>
Reply-To: "YangKai Liu" <yangkailiu@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> <3fb9b44e$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <3fb9f473$1@newsgroups.borland.com>
Date: 18 Nov 2003 02:29:07 -0700
X-Trace: newsgroups.borland.com 1069151347 207.105.83.66 (18 Nov 2003 02:29:07 -0700)
Lines: 44
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!fu-berlin.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail