看板 Database 關於我們 聯絡資訊
想了一個早上,終於想到方法了 其實也不是很複雜 = =" 只要把IF搬出來用.. 在已知目前資料 id 跟 ord 的情況下: select * from A where id = IFNULL( (SELECT id From A where id < $id and ord=$ord order by id desc limit 1) ,(SELECT id FROM A WHERE ord >$ord order by ord limit 1) ) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.105.55.117 ※ 編輯: JYHuang 來自: 59.104.153.93 (12/30 00:27)