SQL一句實現上一條 下一條信息
SELECT UserId AS id FROM IndagateResult
WHERE (UserId = (SELECT Max(UserId ) FROM IndagateResult WHERE UserId < 741))
UNION ALL SELECT UserId AS id FROM IndagateResult
WHERE (UserId = (SELECT Min(UserId ) FROM IndagateResult WHERE UserId > 741))
WHERE (UserId = (SELECT Max(UserId ) FROM IndagateResult WHERE UserId < 741))
UNION ALL SELECT UserId AS id FROM IndagateResult
WHERE (UserId = (SELECT Min(UserId ) FROM IndagateResult WHERE UserId > 741))