gpt4 book ai didi

php - 如何编辑 mySQL 查询来选择具有此要求的用户?

转载 作者:行者123 更新时间:2023-11-29 06:46:22 25 4
gpt4 key购买 nike

我有下表,我想选择 type_id 等于 3 的行和 type_id 等于 5 的行的所有用户。

我知道我错了,但是我该如何编辑我的查询?

表格

user --- type--- type_id
abc ---- form --- 3
abc ---- form --- 5
abc ---- form --- 6

查询

Select user from table where type = 'form' and type_id = 3 and type_id = 5

最佳答案

您可以加入同一个表并检查 type_id 是否具有您想要的值:

select t1.user 
from table t1
inner join on t1.user = t2.user and t2.type='form' and t2.type_id = 5
where t1.type = 'form'
and t1.type_id = 3

关于php - 如何编辑 mySQL 查询来选择具有此要求的用户?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49245513/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com