MySQL Forums
Forum List  »  Optimizer & Parser

Re: Need recommendation regarding IN expression
Posted by: Solon Barns
Date: February 23, 2006 12:59AM

Thank you!

I do need GROUP BY because I will be selecting time on page per registrant (I made a mistake in the first query). But anyway, I see know that INNER JOIN is a better solution.

So I will rewrite the query like this:

SELECT registrant_id, SUM(time_on_page)
FROM page_views p
INNER JOIN selected_registrants s
ON p.registrant_id = s.registrant_id
AND s.report_id = 1569
GROUP BY registrant_id;

BTW, you specified the s.report_id = 1569 as JOIN condition rather than WHERE condition, is it more efficient?

Thanks, Solon.

Edited 2 time(s). Last edit at 02/23/2006 02:57AM by Solon Barns.

Options: ReplyQuote

Written By
Re: Need recommendation regarding IN expression
February 23, 2006 12:59AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.