G
geebee
hi,
I have the following:
SELECT DISTINCT Tbl_MasterPop.Status, Count(Tbl_MasterPop.Status) AS
CountOfstatus, Sum(Tbl_MasterPop.[Principal Balance]) AS [SumOfprincipal
balance], Avg(Tbl_MasterPop.NETBAL) AS AvgOfNETBAL, Count(Tbl_MasterPop.[New
Institution Name]) AS [CountOfNew Institution Name]
FROM Tbl_MasterPop
WHERE (((Tbl_MasterPop.Status) Not In
('CHARGEOFF','PAIDOFF','CURRENT_AMD/DEFR','CURRENT_PAID','CURRENT_BKAMD/DEF','REPO')))
GROUP BY Tbl_MasterPop.Status
ORDER BY Tbl_MasterPop.Status
UNION ALL
SELECT tbl_resolved.PrevStatus, *
FROM tbl_resolved
WHERE (((tbl_resolved.PopEnterDt)=(SELECT min(popenterdt)
FROM tbl_resolved
WHERE tbl_masterpop.[loan acct #] = tbl_resolved.[loan acct #])) AND
((tbl_resolved.PrevStatus)="new"));
however, I am getting an error message:
"the number of columns in the two selected tables or queries of a union
query do not match."
I do not want to list all the fields of the tbl_masterpop. all i want to do
is combine the results of both tables. what can i do differently or what am
i doing wrong?
thanks in advance,
geebee
I have the following:
SELECT DISTINCT Tbl_MasterPop.Status, Count(Tbl_MasterPop.Status) AS
CountOfstatus, Sum(Tbl_MasterPop.[Principal Balance]) AS [SumOfprincipal
balance], Avg(Tbl_MasterPop.NETBAL) AS AvgOfNETBAL, Count(Tbl_MasterPop.[New
Institution Name]) AS [CountOfNew Institution Name]
FROM Tbl_MasterPop
WHERE (((Tbl_MasterPop.Status) Not In
('CHARGEOFF','PAIDOFF','CURRENT_AMD/DEFR','CURRENT_PAID','CURRENT_BKAMD/DEF','REPO')))
GROUP BY Tbl_MasterPop.Status
ORDER BY Tbl_MasterPop.Status
UNION ALL
SELECT tbl_resolved.PrevStatus, *
FROM tbl_resolved
WHERE (((tbl_resolved.PopEnterDt)=(SELECT min(popenterdt)
FROM tbl_resolved
WHERE tbl_masterpop.[loan acct #] = tbl_resolved.[loan acct #])) AND
((tbl_resolved.PrevStatus)="new"));
however, I am getting an error message:
"the number of columns in the two selected tables or queries of a union
query do not match."
I do not want to list all the fields of the tbl_masterpop. all i want to do
is combine the results of both tables. what can i do differently or what am
i doing wrong?
thanks in advance,
geebee