일부 쿼리는 다음 쿼리를 사용하십시오.이 쿼리는 어떻게 해결합니까?
여러 미터가있는 모든 고객을 나열하십시오.
나는 ... 나는 성공없이 다음과 같은 쿼리를 시도Customers – minimum 20 records
Meters – min. 30 records
Meter Readings – min. 100 readings
Invoices – 1 per Meter Reading
..이 해결하기 쉬운 문제가있는 경우 완전한 newb 그래서 용서
select *
from Customers
LEFT OUTER JOIN Meters ON Customers.idCustomers = Meters.Customers_idCustomers
where Customers.idCustomers = Customers.idCustomers;
I 해요 또한 SELECT CASE 쿼리를 시도했습니다
감사! MySQL의에서
select c.*
from customers c
where c.idCustomer in (select idCustomer
from Meters
group by Customers_idCustomers
having count(*) > 1
)
, 당신은 또한 의해 그룹과 가입으로 이것을 표현할 수있다 : 여기
데이터 구조는 무엇입니까? –
정확히 무엇을하려고합니까? 'Meters' 레코드가 둘 이상있는'Customers' 레코드를 모두 찾으십시오. 테이블은 어떻게 생겼습니까? – zajd
데이터베이스의 구조에 따라 다르지만 한 가지 공통적 인 해결책은'group by '및'counting (*)> 1'이있는 내부 조인입니다. – theglauber