以下三條sql語句的效果是等效的:
SELECT * FROM `logs` WHERE id = 1 or id = 2 or id = 3
SELECT * FROM `logs` WHERE id between 1 and 3
SELECT * FROM `logs` WHERE id in (1,2,3)
經(jīng)過測試性能也是差不多,如果id是一個(gè)大數(shù)組那么最后一條書寫會(huì)簡單很多,可以利用php的
函數(shù)把數(shù)組組合成(implode(',',$array))也就是(1,2,3)這樣的格式
]]>