Board index » delphi » To build a query by using the results of other queries

To build a query by using the results of other queries

Hi,
I want to prepare a query which will use the data sets of other queries ( as
in Microsoft Access). To illustarate the problem, let's say, there are
QueryA and QueryB. QueryA   has the fields  [ProductID] and [Quantity].
QueryB   has the fields  [ProductID] and [Volume].

With these datasets, how can I prepare a QueryC which has the fields
[ProductID] and [TotalVolume]=[Quantity]*[Volume].

Thanks a lot,

 

Re:To build a query by using the results of other queries


You should do a query joining both tables not the querys

select TableA.ProductID, TableA.Quantity * TableB.Volume as TotalVolume
from TableA, TableB
where TableA.ProductID = TableB.ProductID and yourcondition...

--
Ing. Eduardo Martinez Ocampo
Chief of Information Systems
Industria Envasadora de Queretaro, SA de CV
The Coca-Cola Canning Plant

Other Threads