Mysql
 sql >> Database >  >> RDS >> Mysql

COUNT(*) da più tabelle in MySQL

Puoi farlo usando le sottoquery, una sottoquery per ogni tableCount :

SELECT
  (SELECT COUNT(*) FROM table1 WHERE someCondition) as table1Count, 
  (SELECT COUNT(*) FROM table2 WHERE someCondition) as table2Count,
  (SELECT COUNT(*) FROM table3 WHERE someCondition) as table3Count