🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.databases
Article #19

First query as input of subsequent query. How?

#19
From: btm
Date: Tue, 03 Aug 1999 00:00
38 lines
1722 bytes
[Delphi 1.02]

I would like to use the result from a first query, e.g.

      procedure TForm1.Button1Click(Sender: TObject);
      begin
      with Query1 do
        begin
        Close;
        SQL.Clear;
        SQL.Add('select * from "MYTABLE.DB" mt');
        SQL.Add('where mt.amount > 100');
        Open;
        end;
      end;

in a subsequent second query. But how can I use the resulting
dataset in this second query?? I tried the following:

      procedure TForm1.Button2Click(Sender: TObject);
      begin
      with Query2 do
        begin
        Close;
        SQL.clear;
        SQL.add('select count(Code) as c1 from wwQuery1');
        Open;

        showmessage(FieldByName('c1').AsString);
        end;
      end;

but this didn't work... How can I access the result of the
first query from within the SQL statement of a second query???

Thanks for any help!

Thomas
Technical Details
Message-ID: <37a74737.1659755@news.spectraweb.ch>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ffff5,455a5e39a9565868,start
X-Google-Attributes: gidffff5,public
X-Google-Thread: 115d96,455a5e39a9565868,start
X-Google-Attributes: gid115d96,public
From: btm@gmx.net (btm)
Subject: First query as input of subsequent query. How?
Date: 1999/08/03
Message-ID: <37a74737.1659755@news.spectraweb.ch>
X-Deja-AN: 508486675
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: usenet@sunrise.ch
X-Trace: news1.sunrise.ch 933709526 6605 194.230.4.215 (3 Aug 1999 19:45:26 GMT)
Organization: sunrise communications ag
Mime-Version: 1.0
Reply-To: NO-SPAMbtm@gmx.net
NNTP-Posting-Date: 3 Aug 1999 19:45:26 GMT
Newsgroups: comp.lang.pascal.delphi.databases,borland.public.delphi.database