I have a SQL table with two columns Date
and User
and contains the following rows:
**Date User**
2009-02-20 Danny
2009-02-20 Matthew
2009-02-15 William
2009-02-15 Abner
2009-12-14 Joseph
1900-01-01 Adam
1900-01-01 Eve
Given a date, how should I write my WHERE clause to return a list of users for that date, or if no users users were found for that date, return a list of users for the next earlier date. For example, if the given date is '2009-02-19', the users list returned should be William and Abner.