Please refer to the following table structure.

stationDate date
staffID varchar(12)

I want top display the records from this table for the last date prior to a station date specified.


Suppose the table contains the following records:---


Staff ID Station Date

1 2004-05-17
2 2004-05-18
3 2004-05-19
2 2004-05-19
1 2004-05-15


If the input date is '2004-05-20' then the output should be :---

Staff ID Station Date

3 2004-05-19
2 2004-05-19

Please use only one query statement using joins in MYSQL. Please do not create any temp tables.

Thanx in advance.