从公司包含1到5名员工的数据库中选择员工

时间:2017-05-09 10:00:36

标签: mysql

到目前为止,我有这个问题:

SELECT
    c.id AS company_id,
    c.company_name,
    COUNT(*) AS employee_count
FROM
    ct_companies c
INNER JOIN ct_employees e ON c.id = e.company_id
GROUP BY
    c.domain,
    c.postcode,
    c.company_name
HAVING
    (
        employee_count >= 1
        AND employee_count <= 5
    )
ORDER BY
    employee_count DESC

现在,这很有效,它会选择至少有1名员工但不超过5名的公司,并向我显示员工人数。

但我希望能够做到的是选择公司内的每个员工,但仅限于该公司拥有1到5名员工的地方。

类似

SELECT e.id FROM ct_employees e WHERE (employee_count >= 1 AND employee_count <= 5)

1 个答案:

答案 0 :(得分:1)

你可以尝试

if("hello".equals(stringForLayout)){
    setContentView(R.layout.activity_main);
}else{
    setContentView(R.layout.activity_main_secondary);
}