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

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -