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

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -