I have to get the name and hacker_id from of hackers with a full score on at least 2 or more challenges. This is my code and the error code that I keep getting, but I can't figure out what to do next to correct it.
SELECT DISTINCT hacker_id, name
FROM hackers
WHERE hacker_id in
(SELECT s.score, hacker_id
FROM submissions as s
INNER JOIN
difficulty as d
on s.score=d.score
GROUP BY hacker_id
HAVING count(hacker_id)>1) as x
INNER Join hackers as h
ON x.hacker_id=h.hacker_id
ORDER BY COUNT(challenge_id) DESC, hacker_id ASC;
ERROR 1064 (42000) at line 21: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'as x inner Join hackers as h on x.hacker_id=h.hacker_id order by count(challenge' at line 10
WHEREhas to come afterINNER JOIN.WHERE hacker_id INON x.hacker_idbecause thexsubquery isn't a table you joined with.