抱歉,您的浏览器无法访问本站

本页面需要浏览器支持(启用)JavaScript


了解详情 >

mysql count() 函数 字段按条件统计数量并排除某个字段重复值

img

img

img

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
SELECT
*, count(c.recruit_info_id) AS apply_number,
count(
IF (c.approval_status= 5, 1, NULL)
) AS s_number
FROM
`sh_further_position_posting` `a`
LEFT JOIN `sh_student_keshi` `b` ON `a`.`student_keshi_id` = `b`.`student_keshi_id`
LEFT JOIN `sh_further_recruit_info` `c` ON `c`.`post_id` = `a`.`post_id`
WHERE
1 = 1
GROUP BY
`a`.`post_id`
ORDER BY
`a`.`create_time` DESC
LIMIT 10

评论