Mysql 加入 - 在同一行中获取结果

Mysql Join - Get result in same row

SELECT COUNT(status) AS COUNT
FROM financeinstallment
WHERE status = 1
GROUP BY financeId
UNION
SELECT finance.financeId,
       finance.customerId,
       customer.customerName,
       customer.phone1,
       customer.aadhaar,
       finance.financeStartDate,
       finance.vehicleNumber,
       finance.loanAmount,
       finance.totalInstallment,
       finance.InstallmentAmount
FROM finance
INNER JOIN customer ON customer.customerId = finance.customerId

如何得到同一行的结果?

我收到以下错误:

Error Code: 1222. The used SELECT statements have a different number of columns 0.000 sec

这里的一种方法可能是将联合中的第二个查询作为子查询加入到第一个查询中。

SELECT
    t.count,
    f.financeId,
    f.customerId,
    c.customerName,
    c.phone1,
    c.aadhaar,
    f.financeStartDate,
    f.vehicleNumber,
    f.loanAmount,
    f.totalInstallment,
    f.InstallmentAmount
FROM finance f
INNER JOIN customer c
    ON c.customerId = f.customerId
INNER JOIN
(
    SELECT financeId, COUNT(status) AS count
    FROM financeinstallment
    WHERE status = 1
    GROUP BY financeId
) t
    ON f.financeId = t.financeId;