Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql SQL使用查询字符串选择喜欢的位置_Mysql_Sql - Fatal编程技术网

Mysql SQL使用查询字符串选择喜欢的位置

Mysql SQL使用查询字符串选择喜欢的位置,mysql,sql,Mysql,Sql,如果我有这两个复杂的查询字符串 ALM_frmTopAlarmHistoryReport.aspx?strAlarmConnection=AlarmSystem 及 如何排除选择类似的位置条件 我试过了 SELECT * FROM [tablename] WHERE string1 LIKE '%string2%' 我得到了下面的错误 Msg 103, Level 15, State 4, Line 1 The identifier that starts with'%st

如果我有这两个复杂的查询字符串

 ALM_frmTopAlarmHistoryReport.aspx?strAlarmConnection=AlarmSystem

如何排除
选择类似的位置
条件 我试过了

 SELECT * FROM [tablename] WHERE string1 LIKE '%string2%' 
我得到了下面的错误

   Msg 103, Level 15, State 4, Line 1
   The identifier that starts with'%string2 ' is too long. Maximum length is 128.

欢迎提供任何帮助,请提前感谢

使用locate或instr:

select *
from tablename
where instr(string2, string1)  > 0
select *
from tablename
where instr(string2, string1)  > 0