Efficient SQL query with multiple selects -
i'm @ university , doing project have queries such as:
select * recent_purchases customer_id in ( select customer_id customers name '%john%' )
i'm not sure if idiomatic way of doing things or if i'm missing "correct" way of doing - feels bit clunky. don't understand joins yet. sorry if stupid question.
use inner join
instead of sub-select in where
clause:
select * recent_purchases rp inner join customers c on c.customer_id = rp.customer_id c.name '%john%'
Comments
Post a Comment