You can do this simply using views in Sybase and MS SQL, probably others too.
Create View open_d as Select * from openday where opendate > 21/06/06 go select * from open_d where day = 'mon' Within D7 you could do similar using datasets or ClientDataSets, then filtering the results by setting Filter = 'day = ''mon'''; You just need to consider that you will be retrieving all the records to the client before restricting the view using the latter method. Michael Darling Senior Solutions Developer ROOM Solutions Ltd mailto:[EMAIL PROTECTED] -----Original Message----- From: Chris Moore [mailto:[EMAIL PROTECTED] asked Hi Group In any RDBMS it is possible to build a query, and then use that query as the basis of another query. Very simple example: open_d = (Select * from openday where opendate > 21/06/06) week_d = (Select * from open_d where day = 'mon') NB this is an EXAMPLE I have no interest in sorting anything by dates, I just want information about the principle. Is it possible to do this in Delphi 7? Create a query, than use the results of that query as the basis of another? IE: (I know this won't work, is there a way of making this work?) myquery1:=tadoquery.create myquery1.sql.add('sql stuff') myquery1.active:=true myquery2:=tadoquery.create myquery2.sql.add('select * from myquery1') myquery2.active:=true ******************************************************************* CONFIDENTIALITY NOTICE/DISCLAIMER This email and any attachments are confidential, protected by copyright/intellectual property rights and may be legally privileged. The information transmitted is intended only for the person or entity to which it is addressed. If you are not the intended recipient, dissemination or copying of this email is prohibited. If you have received this in error, please notify us by forwarding this email to the following address: [EMAIL PROTECTED] , and then delete the email completely from your system. This email and any attachments have been scanned for computer viruses by a market leading anti-virus system. However, it is the responsibility of the recipient to conduct its own security measures. No responsibility is accepted by ROOM Solutions Limited for loss or damage arising from the receipt or use of this email and any attachments. No responsibility is accepted by ROOM Solutions Limited for personal emails. ROOM Solutions Ltd, http://www.roomsolutions.net ******************************************************************** ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ _______________________________________________ Delphi-DB mailing list Delphi-DB@elists.org http://www.elists.org/mailman/listinfo/delphi-db