Thread View: comp.lang.pascal.delphi.databases
2 messages
2 total messages
Started by btm
Tue, 03 Aug 1999 00:00
First query as input of subsequent query. How?
Author: btm
Date: Tue, 03 Aug 1999 00:00
Date: Tue, 03 Aug 1999 00:00
38 lines
1722 bytes
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
Re: First query as input of subsequent query. How?
Author: Markku Nevalainen
Date: Wed, 04 Aug 1999 00:00
Date: Wed, 04 Aug 1999 00:00
18 lines
1152 bytes
1152 bytes
btm wrote: > > > 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! > You can save the results from the first Query1 to a disk file, and do the second Query against this table: dbiMakePermanent(Query1.Handle, 'C:\TEST.DB',True); If you have multi user environment, there may be some problems where you direct that temporary table, but it should work also there. Markku Nevalainen
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads