Article View: borland.public.cppbuilder.database.ado
Article #3564Re: How to get the result "select count(*) from ..."
From: Arnie Mauer
Date: Wed, 10 Jul 2002 15:26
Date: Wed, 10 Jul 2002 15:26
54 lines
2358 bytes
2358 bytes
Hi Peter,
If I understand you correctly, something like:
qry->SQL->Add( "select count(*) MyCount from ATable where x=25" );
qry->Open();
int myCount = qry->FieldByname( "MyCount" )->AsInteger;
- Arnie
"Peter Schoner" <schoner@wirtschaft.uni-kassel.de> wrote in message
news:3d2c4602_1@dnews...
> Hi!
>
> I am very familiar with SQL but not with the complete BCB5 possibilities.
>
> I simply wanted to get a number of records with
> Form1->SQL_Params->SQL->Add("select count(*) from T_output where i_Reakt =
> 'R01'");
>
> or the values
> Form1->SQL_Params->SQL->Add("select diestinct i_Reakt from T_output");
>
>
> However the help file says:
> "A live result set for a query against a single table or view is returned
if
> the query does not contain any of the following:
>
> DISTINCT in the SELECT clause
> Joins (inner, outer, or UNION)
> Aggregate functions with or without GROUP BY or HAVING clauses
> Base tables or views that are not updatable
> Subqueries
> ORDER BY clauses not based on an index"
>
>
> So, how can I ask these questions to my database? It does not work with
> TQuery! Does it work TIBQuery?
>
>
> Thanks in advance
> Peter
>
> .........................
> Dipl.-Math. Peter Schoner
> MAIL: schoner@wirtschaft.uni-kassel.de
>
> Uni Kassel -- Wirtschaftswissenschaften
> FG Produktionswirtschaft und Logistik
> www.wirtschaft.uni-kassel.de/vahrenkamp
>
> Nora-Platiel-Str. 4 -- 34127 Kassel
>
>
Technical Details
Message-ID:
<3d2c5267$1_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnewsReferences:
<3d2c4602_1@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10698b,bcad3e0669853dd8 X-Google-Attributes: gid10698b,public X-Google-ArrivalTime: 2002-07-10 10:00:56 PST From: "Arnie Mauer" <amauer@vrms.com> Newsgroups: borland.public.cppbuilder.database.ado References: <3d2c4602_1@dnews> Subject: Re: How to get the result "select count(*) from ..." Date: Wed, 10 Jul 2002 11:26:38 -0400 Lines: 56 Organization: VRMS X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 NNTP-Posting-Host: 209.140.211.97 Message-ID: <3d2c5267$1_1@dnews> X-Trace: dnews 1026314855 209.140.211.97 (10 Jul 2002 08:27:35 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-08!supernews.com!newsfeed.news2me.com!newsfeed.wirehub.nl!PeerFeed.KWeb.on.ca!dnews