select c.id_circuit, count(cl.id_curcuit_language) as RecCount
from circuit c
inner join circuit_langue cl on c.id_circuit = cl.#id_circuit
group by c.id_circuit
having count(cl.id_curcuit_language) > 2
select circuit.*
from circuit,
(select id_circuit
from circuit_langue
group by id_circuit
having count(*) >2 ) lang
where circuit.id_circuit = lang.id_circuit;
3条答案
按热度按时间gpfsuwkq1#
不
join
有必要:这假设表中没有重复项。如果有,那么你想用
count(distinct language) >= 3
.kuarbcqp2#
你需要使用
group by
与having
比如:pod7payv3#
你可以试试这个(甲骨文风格):
这个查询提供了circuits表中的整行,所以您可以访问任何列。另一方面,如果您只需要“id\u circuit”列,那么gordon linoff的答案是最好的。