Oracle
 sql >> Database >  >> RDS >> Oracle

Oracle/SQL:combinazione di conteggi da tabelle non correlate "non correlate".

Prova questo:

SELECT (SELECT COUNT(*) AS good 
        FROM   table_good 
        WHERE  widget = 'Widget A' 
               AND good = 'Y') AS good, 
       (SELECT COUNT(*) AS bad 
        FROM   table_bad 
        WHERE  widget = 'Widget A' 
               AND bad = 'Y')  AS bad 
FROM   dual