You can just change the last part to have a subquery (I will use in
so you can have multiple values in the WHERE
clause)
SELECT a.CLIENTID,
a.CLIENTNAME,
a.CREATEDATE,
b.AREACODE,
b.PHONENUMBER
FROM CLIENT a
INNER JOIN PHONE b ON a.CLIENTID = b.CLIENTID
WHERE b.AREACODE IN
/* You can put your query inside the ()s */
(SELECT TOP 10 AREACODE FROM PHONE)
;
Not sure if you are using it for practicing, or real life scenarios, but introducing subqueries can significantly increase the time the script takes to execute.
solved How do I turn this WHERE Query into a SubQuery in Oracle SQL? [closed]