【发布时间】:2016-06-12 08:56:17
【问题描述】:
有人可以帮忙吗,我需要从所有字段值(如 %someString%)的字段中获取所有值。我的表有 17 个字段,我不想在查询中写入所有字段。数据库 Mysql。
select * from Deputes_APPEAL where filePath, checkForPlagiarism, contentOfResolution, countOfPages, dateForCheck, incomeNumber, incomingDate, mainWorker, nameAndAddressOfApplicant, nameOfDepute, outDate, outNumber, result, secondaryWorkers, shortContentOfAppeal, statusOfWorking, themeOfAppeal, TypeOfDeputeAppeal, unitWhoDoResolution like %someString%
【问题讨论】:
-
在查询中编写 17 个字段比发布此问题花费的时间更少。
-
也许,但这不正确?
-
发布您的表结构,并在
LIKEclause 中提及您要省略哪些字段。 -
select * from Deputes_APPEAL where filePath like '%someString%' or checkForPlagiarism like '%someString%' or ...: 这将找到至少一个字段类似于 %someString% 的所有行。如果它们都应该像 %someString%,那么使用 and 而不是 or。 -
我可以写 select * from Deputes_APPEAL where concat (all fields) like %someString%, sql 有通用子句吗?我不想列出查询中的所有字段