У меня получилось вот так, но не знаю насколько оптимальный вариант: Код (Text): SELECT * FROM ( SELECT COUNT(DISTINCT(id)) as orders_wait FROM log_orders WHERE date_add BETWEEN '$getDate 00:00:00' AND '$getDate 23:59:59' AND status = '1' ) T1, ( SELECT COUNT(DISTINCT(id)) as orders_hold FROM log_orders WHERE date_add BETWEEN '$getDate 00:00:00' AND '$getDate 23:59:59' AND status = '2' ) T2, ( SELECT COUNT(DISTINCT(id)) as orders_accept FROM log_orders WHERE date_add BETWEEN '$getDate 00:00:00' AND '$getDate 23:59:59' AND status = '3' ) T3
Код (Text): SELECT COUNT(DISTINCT(CASE WHEN status = 1 THEN id END)) as orders_wait, COUNT(DISTINCT(CASE WHEN status = 2 THEN id END)) as orders_hold, COUNT(DISTINCT(CASE WHEN status = 3 THEN id END)) as orders_accept FROM log_orders WHERE date_add BETWEEN '$getDate 00:00:00' AND '$getDate 23:59:59'; SQLize - format run and share SQL queries online
Круто, я только не могу понять, Ваш вариант более оптимальный и более быстрый или просто альтернативный? То что он более компактный - факт.