Pendekatan pertama. Pilih ini mengembalikan 3 baris. Baris yang Anda pilih dan baris untuk tanggal sebelumnya dan baris berikutnya untuk tanggal berikutnya:
SELECT * FROM (
SELECT
'THIS' as update_time,
update_id,
project_id,
content,
date
FROM
`update`
WHERE
update_id = 2 AND project_id = 2
ORDER
BY date DESC
LIMIT 1
) TT
UNION
SELECT * FROM (
SELECT
'PREVIOUS' as update_time,
update_id,
project_id,
content,
date
FROM
`update`
WHERE
update_id <> 2 AND project_id = 2 and
date <= (select date from `update` where update_id = 2)
ORDER
BY date DESC
LIMIT 1
) TP
UNION
SELECT * FROM (
SELECT
'NEXT' as update_time,
update_id,
project_id,
content,
date
FROM
`update`
WHERE
update_id <> 2 AND project_id = 2 and
date >= (select date from `update` where update_id = 2)
ORDER
BY date ASC
LIMIT 1
) TN