0

如何在 1 个表中搜索相同的字段

SELECT id, issues, status FROM docus WHERE statusLIKE '%Done%' AND issueLIKE '%Other%' AND issueLIKE '%Transfer%' ORDER BY id

我试过了,但结果为零

4

3 回答 3

2

我想你的意思是

(issue like '%Other%' OR issue like '%transfer%')

除非您想获取问题列中同时包含 Transfer 和 Other 的行

于 2012-05-09T07:24:17.960 回答
0

我想你想匹配以下任何一个。如果是这种情况,请使用OR而不是AND运算符:

SELECT id, issues, `status`
FROM docus 
WHERE `status` LIKE '%Done%' OR
      issues LIKE '%Other%' OR
      issues LIKE '%Transfer%' 
ORDER BY id

或者

SELECT id, issues, `status`
FROM docus 
WHERE `status` LIKE '%Done%' AND
      (issues LIKE '%Other%' OR
      issues LIKE '%Transfer%' )
ORDER BY id
于 2012-05-09T07:24:40.690 回答
0

这是您重新格式化的 SQL 查询,它应该可以为您提供所需的信息。

SELECT id, issues, status 
FROM docus 
WHERE status LIKE '%Done%' 
AND (issue LIKE '%Other%' OR issue LIKE '%Transfer%') 
ORDER BY id
于 2012-05-09T07:25:26.283 回答