optimization - How can I optimize this mySQL query with JOIN or other operations? -


forgive newbie question, i'm still new mysql...just getting things run tricky. spent few hours writing monstrosity:

select orders_comments.orderid, orders_comments.mediaid, orders_comments.imageurl, orders_comments_comments.comment     orders_comments      join orders_comments_comments      on orders_comments.orderid = orders_comments_comments.orderid     join      (         select distinct orderid                  (             select * orders_comments             orders_comments.orderid not in              (                  select log_comments.orderid                  log_comments                  join users_comments                  on (log_comments.userid = users_comments.userid)                  users_comments.userid = :userid              )             , orders_comments.userid != :userid          ) validorders         order orderid asc          limit :numorderstoreceive     ) distinctorders     on orders_comments.orderid = distinctorders.orderid 

i've read subqueries not , can better join operations, complexity of query has me beat. @ quick glance, there obvious improvements made?


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -