作者:欧泊王_121 | 来源:互联网 | 2023-01-14 17:46
Ihaveatablewhichhasmillionrows.Ithasuseridasitsprimarykey.Ihaveanarrayhaving500
I have a table which has million rows. It has user id as its primary key. I have an array having 500 user ids in it.
我有一个有百万行的表。它具有用户标识作为其主键。我有一个包含500个用户ID的数组。
I want to select all the records from the table whose user ids are in the array. I know one method to do this is to change the array into a string and run IN query by passing the string.
我想从表中选择用户ID在数组中的所有记录。我知道一种方法是将数组更改为字符串并通过传递字符串来运行IN查询。
But I think it is not the efficient way to do it. So kindly suggest other ways.
但我认为这不是有效的方法。所以善意地建议其他方式。
4 个解决方案