1

Topic: How to make JOIN penultimate record, being based on already selected date?

There is such request:

SELECT
c.id;
b.date
FROM client c
JOIN bill b on b.client_id = c.client_id

Result:

id | date
1 | 2017-09-03 11:11:11 PM
2 | 2017-09-01 1:22:01 AM

There is a table history dataful on changes of the status of the client of a type:

record_id | changeDate | client_id | status
1 | 2017-09-02 0:00:00 AM | 1 | new
2 | 2017-09-05 0:00:00 AM | 1 | active
3 | 2017-09-01 0:00:00 AM | 2 | old
4 | 2017-09-20 0:00:00 AM | 2 | active

Question: how  the table history to the first sampling to deduce at the client the last status, at which date changeDate is less, than b.date from the first sampling ?
That is as a result should be so:

id | date | previousStatus
1 | ' 2017-09-03 11:11:11 PM ' | ' new'
2 | ' 2017-09-01 1:22:01 AM ' | ' old'