Mysql
 sql >> Base de Dados >  >> RDS >> Mysql

Contar consulta do tipo união mysql


Basta contar os resultados da subconsulta...
SELECT COUNT(t.*) FROM
(   (SELECT 1 AS sort_col,performerid,pic0 
       FROM $table 
       WHERE performerid IS NOT NULL 
         $performeridSql) 
  UNION 
    (SELECT 2 AS sort_col,performerid,pic0 
       FROM $table 
       WHERE performerid IS NOT NULL 
         $categorySql $buildSql 
         $breastsize $haircolor $age $ethnicity 
         $willingnessSql)
  ORDER BY sort_col)
) AS t