Solon Barns wrote:
> 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).
Cool, looks like you got the query correct! :)
> BTW, you specified the s.report_id = 1569 as JOIN
> condition rather than WHERE condition, is it more
> efficient?
For an INNER JOIN, the optimizer is capable of understanding that having the report_id = 1569 is equivalent to filtering the selected_registrants table *before* doing the join to page_views. This is a stylistic thing that I have adopted for two reasons:
1) I believe it makes the SQL more clear in where the filter on report_id is occurring.
2) If you choose to at some point change the INNER JOIN to a LEFT JOIN, you have your filter in the correct place (the ON condition vs. the WHERE clause)
HTH
Jay Pipes
Community Relations Manager, North America, MySQL Inc.
Got Cluster?
http://www.mysql.com/cluster
Personal:
http://jpipes.com