MySQL WHERE IN ()(MySQL WHERE IN ())
问题描述
我的查询是:
我将它用于用户组,并且一个用户可以在多个组中.但似乎当一条记录具有多个 id 时,例如 1 和 3,mySQL 不会返回该行.
I use it for usergroups and a user can be in more than one group. but it seems that when a record has multiple id like 1 and 3, mySQL does not return that row.
有什么办法也可以得到那一行吗?
Is there any way to get that row too?
推荐答案
您的查询转化为
它只会返回与其匹配的结果.
It will only return the results that match it.
避免复杂性的一种解决方法是将数据类型更改为SET
.然后你可以使用,FIND_IN_SET
One way of solving it avoiding the complexity would be, chaning the datatype to SET
.
Then you could use, FIND_IN_SET
这篇关于MySQL WHERE IN ()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!