Support/Interesting queries: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
No edit summary
 
Line 34: Line 34:
==Polls with the most "Helpful" votes per week ==
==Polls with the most "Helpful" votes per week ==
See [http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_yearweek YEARWEEK].
See [http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_yearweek YEARWEEK].
  SELECT tp.title, SUM(voteCount) votes FROM tiki_poll_votes tpv INNER JOIN tiki_poll_options tpo ON tpo.optionId = tpv.optionId INNER JOIN tiki_polls tp ON tp.pollId = tpo.pollId WHERE YEARWEEK(voteDate, 3) = '200812' AND position = 1 GROUP BY tp.title ORDER BY voteDate, votes;
  SELECT tp.title, SUM(voteCount) votes FROM tiki_poll_votes tpv INNER JOIN tiki_poll_options tpo ON tpo.optionId = tpv.optionId INNER JOIN tiki_polls tp ON tp.pollId = tpo.pollId WHERE YEARWEEK(voteDate, 3) = '200812' AND position = 0 GROUP BY tp.title ORDER BY voteDate, votes;




103

edits

Navigation menu