MySQL 1,000的OR语句(好主意?)

The*_*Man 5 mysql sql twitter mysqli

我正在构建一个Twitter应用程序,它可以抓取用户整个关注并获得他们的特定ID Ex:1223455

我还有一个庞大的数据库,其中包含一些包含特定Twitter id的行...请查看行中的示例...

|1| 122345   |
|2| 2232144  |
|3| 99653222 |
|4| 123232   |
|5| 2321323  |
|6| 3121322  |
Run Code Online (Sandbox Code Playgroud)

问题是我们都知道Twitter是关于越来越多的关注者(1,000的),我很奇怪这是一个很好的MySQL查询,在一个脚本运行中可能运行多达20次...

SELECT * FROM table WHERE twitterID='132323' OR twitterId='23123' OR twitterId='23123' OR twitterId='23123' OR twitterId='23123' OR twitterId='23123' OR twitterId='23123' OR twitterId='23123
Run Code Online (Sandbox Code Playgroud)

并且一次又一次地......在一个查询中可能有超过1,000个OR语句(像这样的类似查询可以被称为20次)

这似乎不是一个非常好的编程习惯,但我没有听说过另一种方式......?

Mik*_*osh 6

使用说明in符:

Select * from table where twitterid in (123,456,789,...)
Run Code Online (Sandbox Code Playgroud)