How to ??

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know to solve the following query .

Select some columns From some tables Where conditions Group By column
Unio
Select some columns From some tables Where conditions Group By Column

After the result being produced, i tried to use the select again towards the result as following .

Select some columns, Sum(column) as TotalIn,Sum(column) as TotalOu
Fro

(Select some columns From some tables Where conditions Group By columns
Unio
(Select some columns From some tables Where conditions Group By Columns

Group by column

the error occurs and this sql is not work.

why ?? Any suggestion to solve it ?

Thax in advance
Daniel.
 
When you use a Union query the fields used must match in both tables in
datatype as well as size. I don't think you can use a Union query as a
subquery. Try creating the Union query as a separate qry and then use that
query inside your first query linking on a related field.
 
Save the union as a query in it's own right (ie MyUnion) and then use it as
the source for the next bit

ie

Select some columns, Sum(column) as TotalIn,Sum(column) as TotalOut
From MyUnion
Group by columns
 
Back
Top