in(...) 对重复结果行 只返回一次
select count(id) from project p inner join task t on p.id=t.projectId;
select count(id) from project where id in(select p.id from project p inner join task t on p.id=t.projectId);
上面两条语句:
当 project 与 task 是一对一时,结果是一样的
当 project 与 task 是一对多时,结果就不一样了