2

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

Community
  • 1
  • 1
yeny314
  • 31
  • 6
  • See http://meta.stackoverflow.com/questions/333952/why-should-i-provide-an-mcve-for-what-seems-to-me-to-be-a-very-simple-sql-query – Strawberry Oct 13 '16 at 16:42

1 Answers1

1

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
CL.
  • 173,858
  • 17
  • 217
  • 259
Mureinik
  • 297,002
  • 52
  • 306
  • 350