我试图弄清楚如何将两个和可能额外的选择查询放入一个视图的 1 个大查询中,但遇到了麻烦。最终结果应该是 1 行,其中包含两列的选定字段的计数。我是否为此使用子选择?
这是前两个查询:
SELECT
COUNT(PIN.APP_UID) AS `Type A outstanding`
FROM PMT_INSP_NORMAL PIN
WHERE
PIN.APP_STATUS = "To_Do"
AND
PIN.DATE_COMPLETED IS NULL
SELECT
COUNT(PSN.APP_UID) AS `Type B outstanding`
FROM PMT_SIGN_NORMAL PSN
WHERE
PSN.APP_STATUS = "To_Do"
AND
PSN.DATE_COMPLETED IS NULL