如何在 1 个表中搜索相同的字段
SELECT id
, issues
, status
FROM docus
WHERE status
LIKE '%Done%' AND issue
LIKE '%Other%' AND issue
LIKE '%Transfer%' ORDER BY id
我试过了,但结果为零
如何在 1 个表中搜索相同的字段
SELECT id
, issues
, status
FROM docus
WHERE status
LIKE '%Done%' AND issue
LIKE '%Other%' AND issue
LIKE '%Transfer%' ORDER BY id
我试过了,但结果为零
我想你的意思是
(issue like '%Other%' OR issue like '%transfer%')
除非您想获取问题列中同时包含 Transfer 和 Other 的行
我想你想匹配以下任何一个。如果是这种情况,请使用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
这是您重新格式化的 SQL 查询,它应该可以为您提供所需的信息。
SELECT id, issues, status
FROM docus
WHERE status LIKE '%Done%'
AND (issue LIKE '%Other%' OR issue LIKE '%Transfer%')
ORDER BY id