Wednesday, May 23, 2012

MySQL COUNT 2 QUERIES example

SELECT SUM(CM+CN) FROM    
   (SELECT COUNT(Email) AS CM FROM
      (SELECT Email 
       FROM supplier_company WHERE Email<>'') AS X) AS XX
   ,
   (
SELECT COUNT(Email) AS CN FROM
       (SELECT Email 
        FROM supplier_contact WHERE Email<>'' AND Email NOT IN
           (SELECT Email 
            FROM supplier_company WHERE Email<>'')) AS Y) AS YY;

No comments:

Post a Comment