पहले दृष्टिकोण। यह 3 पंक्तियों का चयन करें। पिछली तिथि के लिए आपकी चयनित पंक्ति और पंक्ति और अगली तिथि के लिए एनोडर पंक्ति:
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