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
Post a Comment