Untitled

 avatar
user_8556937499
plain_text
2 years ago
779 B
1
Indexable
Never
SELECT DISTINCT(submission_date), 
(SELECT COUNT(DISTINCT(hacker_id)) FROM Submissions WHERE submission_date=s.submission_date),
(SELECT hacker_id FROM Submissions WHERE s.submission_date=submission_date GROUP BY hacker_id ORDER BY COUNT(*) DESC, hacker_id ASC LIMIT 1) AS myhacker_id,
(SELECT name FROM Hackers WHERE hacker_id=myhacker_id)
 FROM Submissions s ORDER BY submission_date ASC;

-- ,(SELECT h.name FROM Submissions s2, Hackers h WHERE s2.hacker_id=h.hacker_id AND s2.submission_date=s.submission_date GROUP BY s2.hacker_id ORDER BY COUNT(*) DESC, s2.hacker_id ASC)  

-- (SELECT s2.hacker_id FROM Submissions s2, Hackers h WHERE s2.hacker_id=h.hacker_id AND s2.submission_date=s.submission_date GROUP BY s2.hacker_id ORDER BY COUNT(*) DESC, s2.hacker_id ASC)