brgdotnet
asked on
How to rewrite this correlated subquery using joins
I have a correlates subquery. The query selects all bank customers with more than one bank account.
SELECT c.cust_id,c.cust_type_cd,c .city FROM customer c
WHERE 2 = (SELECT COUNT(*)
FROM account a WHERE a.cust_id = c.cust_id)
So my question is, how can I rewrite this query, so that is uses only joins?
SELECT c.cust_id,c.cust_type_cd,c
WHERE 2 = (SELECT COUNT(*)
FROM account a WHERE a.cust_id = c.cust_id)
So my question is, how can I rewrite this query, so that is uses only joins?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
There won't be any duplicates after using GROUP BY...