What is the best way to select multiple rows by ID in sql?

后端 未结 5 1260
南方客
南方客 2021-02-03 23:37

I need to select multiple records

I use

SELECT *
FROM `table`
WHERE `ID` =5623
   OR `ID` =5625
   OR `ID` =5628
   OR `ID` =5621

this

5条回答
  •  滥情空心
    2021-02-04 00:04

    SELECT *
    FROM `table`
    where ID in (5263, 5625, 5628, 5621) 
    

    is probably better, but not faster.

提交回复
热议问题