Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想要一个用于返回输入值列表并获取返回列表的 sql 查询。假设我在一个表中有两个字段。值 [1-a,2-b,3-c,4-d],我传入 [a,c] 我如何得到 [1,3]?
select * from tablename where columname1 in ('a','c');
您需要遍历查询列表并将结果存储在结果列表中。我认为您不能一次查询值列表。另一种方法是您可以使用'where value = a or value = c'。
这将为您提供所需的输出-
select group_concat(col2) where col1 in ('a','c')