Hi Chris,

Yes, normally most Relational Databases which are things like Interbase, 
Firebird, SQL, MySQL, etc call this type of thing a View.  It isn't 
something you normally do in Delphi itself, although you may find you 
are able to create the view from Delphi in one command, and then use 
another query to select against that View name, which acts much like the 
table name in a normal select.

View:   open_d
Select * from openday where opendate > 21/06/06

Query:   
Select * from open_d where day = 'mon'


You define your View with the base query, and then issue another query 
against the View itself to further refine your results.  :)

I hope that helps.


Kind regards,


Scott :)

Chris Moore wrote:
> 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
>
> As ever - TIA - Chris
>
> Chris Moore
> Computer Department
>
> Brother Industries (UK) Ltd
>  
>
>
>
> _______________________________________________
> Delphi-DB mailing list
> Delphi-DB@elists.org
> http://www.elists.org/mailman/listinfo/delphi-db
>
>
>   
_______________________________________________
Delphi-DB mailing list
Delphi-DB@elists.org
http://www.elists.org/mailman/listinfo/delphi-db

Reply via email to