Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- qotwQuestion1a(QuestionId [primarykey], Question, MemberId, PostDate);
- qotwVote1a (QuestionId [primarykey], MemberId [primarykey], Vote1a);
- qotwMember (MemberId [primarykey], Name, Password, emailId);
- $result6 = mysql_query("SELECT MAX(Vote1a) AS highestVote, * FROM qotwMember, qotwQuestion1a , qotwVote1a
- WHERE qotwMember.MemberId=qotwQuestion1a.MemberId
- AND qotwQuestion1a.QuestionId=qotwVote1a.QuestionId
- AND qotwQuestion1a.MemberId=qotwVote1a.MemberId
- AND PostDate>='".$startofweek."' AND PostDate<='".$endofweek."'
- ORDER BY qotwQuestion1a.QuestionId DESC ");
- while($row6 = mysql_fetch_array($result6))
- {
- echo "The highest voted question of the last week is: "; echo $row6['highestVote']; echo $row6['MemberId'] . " " . $row6['Name'] . " " . $row6['Password'] . " " . $row6['PostDate'] . " " . $row6['Question']." ".$row6['QuestionId']." ".$row6['Vote1a'];
- echo "<br />";
- }
- SELECT *
- FROM (
- SELECT q.QuestionId, q.MemberID
- FROM qotwQuestion1a q
- JOIN qotwVote1a v
- ON v.QuestionID = q.QuestionID
- WHERE PostDate BETWEEN $startdate AND $enddate
- GROUP BY
- q.questionID
- ORDER BY
- COUNT(*) DESC
- LIMIT 1
- ) qo
- JOIN qotwMember m
- ON m.MemberID = q.MemberID
Add Comment
Please, Sign In to add comment