New feature! Upgrade and increase expert visibility of your issues with Priority Questions.
$query = "SELECT Player.MembershipNo, Player.FirstName, Player.LastName, SubSelect.VenueName AS Venue, SubSelect.sum_points as Venue_Points, SubSelect.count_results as Venue_Play_Count, SubSelect3.sum_points3 as Total_Points FROM Player, (SELECT Player1.MembershipNo, Venue1.VenueName, SUM(Position1.Points) AS sum_points, COUNT(Player1.MembershipNo) AS count_results FROM Player Player1, Results Results1, Position Position1, Venue Venue1 WHERE Player1.MembershipNo = Results1.MembershipNo AND Results1.Position = Position1.Position AND Venue1.VenueID = Results1.VenueID GROUP BY Player1.MembershipNo, Venue1.VenueID) SubSelect, (SELECT Player3.MembershipNo, SUM(Position3.Points) AS sum_points3 FROM Player Player3, Results Results3, Position Position3 WHERE Player3.MembershipNo = Results3.MembershipNo AND Results3.Position = Position3.Position GROUP BY Player3.MembershipNo) SubSelect3 WHERE Player.MembershipNo = SubSelect.MembershipNo AND SubSelect.sum_points=(SELECT MAX(SubSelect1.sum_points2) FROM (SELECT Player2.MembershipNo, Venue2.VenueName, SUM(Position2.Points) AS sum_points2 FROM Player Player2, Results Results2, Position Position2, Venue Venue2 WHERE Player2.MembershipNo = Results2.MembershipNo AND Results2.Position = Position2.Position AND Venue2.VenueID = Results2.VenueID GROUP BY Player2.MembershipNo, Venue2.VenueID) SubSelect1 WHERE SubSelect1.MembershipNo = SubSelect.MembershipNo) AND Player.MembershipNo = SubSelect3.MembershipNo AND SubSelect.sum_points >= 750 ORDER BY SubSelect.sum_points DESC";
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.