yeny314 yeny314 - 1 year ago 64
MySQL Question

Listing later dates in comparison to another entry in SQL

How would I list the students who started later than start year of student with id = 8871?

This is what I have so far:

SELECT sid s1
FROM Student
WHERE s1.started <= sid = '8871';

I went to this link for some reference but I'm still having issues:
Query comparing dates in SQL

Student Table has:
Student (Lastname, Firstname, SID, Started)

any help would be great

Answer Source

I'd use a self join where one side of the join contains the students you want and the the reference student 8871:

FROM   student a
JOIN   student b ON b.sid = '8871' AND a.started  > b.started
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download