我想从java.lang.NumberFormatException: For input string: "863092+01"
表
最简单的方法就是这样
Company
但是,我有另一张表"Select id from Company "
Company Table
id company
1 comA
2 comB
3 comC
通过company_id与Member Table
相关联
Company Table
现在我想选择“拥有两名以上成员的公司”
(在这种情况下Member Table
id company_id companymember
1 1 john
2 1 Tam
3 2 haya
4 1 lee
5 3 kih
6 3 wild
和comA
有两个成员)
如何通过SQL实现?
答案 0 :(得分:2)
您可以使用group by
和having
select company, count(*)
from Company a
inner join member b on a._id = b.company_id
group by company
having count(*) > 2
答案 1 :(得分:0)
SELECT
Company.company, count(*)
FROM
Company
JOIN
Member on Company.id = Member.company_id
GROUP BY
Company.company
HAVING
count(*) > 2