So I have two tables students (PK sID) and mentors (PK pID). This query
SELECT s.pID FROM students s JOIN mentors m ON s.pID = m.pID WHERE m.tags LIKE \'%a%\
Use this
SELECT DISTINCT s.pID as PID FROM students s JOIN mentors m ON s.pID = m.pID WHERE m.tags LIKE '%a%' ORDER BY s.sID DESC,1;