yeny314
yeny314

Reputation: 41

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

Upvotes: 2

Views: 60

Answers (1)

Mureinik
Mureinik

Reputation: 311723

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

SELECT a.*
FROM   student a
JOIN   student b ON b.sid = '8871' AND a.started  > b.started

Upvotes: 1

Related Questions