以下查询在未找到值时返回 NULL。我怎样才能If
在他们两个周围分别添加一个,所以如果它Null
那么Not Found
返回查询的结果?
SET @id = 26;
SELECT
(SELECT id FROM devTable WHERE id <= @id AND country = 'US' ORDER BY id DESC LIMIT 9,1) AS `prev`,
(SELECT id FROM devTable WHERE id >= @id AND country = 'US' ORDER BY id ASC LIMIT 1,1) AS `next`