Combining 2 select queries
Hello,
I have 2 queries. they both return some values and those values are connected with each other. i need to combine both of these . how do i do that?
1st query:
Code:
SELECT
M.RegionCode,
M.ProgramType,
SUM(E.Amount) AS ActualsNonReconciled,
Count(Distinct M.MeetingID) AS ActNonRecNoOfMtgs
FROM
Expenses E,
Meetings M,
Users U
WHERE
E.MeetingID = M.MeetingID AND
M.FinancialsReconciled = 0 AND
M.SubCompanyCode = U.SubCompanyCode AND
M.PointPerson = U.Username AND
M.SubCompanyCode = 'abc' AND
M.ProgramCode = 'def' and
M.PointPerson = 'G1AA'
Group BY
M.RegionCode,
M.ProgramType
result:
Code:
RegionCode ProgramType ActualsNonReconciled ActNonRecNoOfMtgs
G1A Meetings 4565.00 2
G1P Meetings 65.00 1
G2C Meetings 1200.00 1
2nd query:
Code:
SELECT
SUM(EE.Amount) AS EstimatesNonReconciled
FROM
Expenses E,
Meetings M,
EstimatedExpenses EE
WHERE
E.MeetingID = M.MeetingID AND
M.SubCompanyCode *= EE.SubCompanyCode AND
M.ProgramCode *= EE.ProgramCode AND
M.ProgramType *= EE.ProgramType AND
M.ServiceLevel*= EE.ServiceLevel AND
E.ExpenseType *= EE.ExpenseType AND
M.SubCompanyCode = 'abc' AND
M.ProgramCode = 'def' AND
M.PointPerson = 'G1AA'and
E.Amount = 0
Group BY
M.RegionCode
result:
Code:
EstimatesNonReconciled
30.88
1872.44
2745.19
my result after combining both should be:
Code:
RegionCode ProgramType ActualsNonReconciled ActNonRecNoOfMtgs
G1A Meetings 4565.00 2
G1P Meetings 65.00 1
G2C Meetings 1200.00 1
EstimatesNonReconciled
30.88
1872.44
2745.19
Please help.
Re: Combining 2 select queries
You can't. For what prupose is this? Or for what reporting tool is your requirement of just one recordset?