【发布时间】:2014-01-19 20:48:35
【问题描述】:
我需要将两个选择语句合并为一个选择
SELECT count(tbl_employer_post_details.employer_id) pending
FROM tbl_employer_post_details,
tbl_employer_registration
WHERE job_status=0
AND tbl_employer_registration.employer_id =
tbl_employer_post_details.employer_id
LIMIT start,max;
第二个查询,唯一的区别是WHERE job_status=1:
SELECT count(tbl_employer_post_details.employer_id) approved
FROM tbl_employer_post_details,
tbl_employer_registration
WHERE job_status=1
AND tbl_employer_registration.employer_id =
tbl_employer_post_details.employer_id
LIMIT start,max;
【问题讨论】:
-
您是要合并计数(例如,员工总数为 5 人,任何一种状态),还是分开(2 人的工作状态为 0,3 人的工作状态为 1)?
标签: mysql sql sql-server select count