简化下。
表:create table tt(ID int,Name varchar(20));
数据:insert tt values(1,'a');select 1 from $t where ID = 1 and 'ca' like '%'+Name;
执行后,提示:
Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '+Name' at line 1
(0 ms taken)
而在Sql Server里面可以运行,请问在mysql应该怎么改?
表:create table tt(ID int,Name varchar(20));
数据:insert tt values(1,'a');select 1 from $t where ID = 1 and 'ca' like '%'+Name;
执行后,提示:
Error Code : 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '+Name' at line 1
(0 ms taken)
而在Sql Server里面可以运行,请问在mysql应该怎么改?
而不是name like '%ca%'
举个例子
select 1 from $t where ID = 1 and instr('ca',name)>0
select 1 from $t where 1=2;
为什么在SqlYog下会返回结果1?
select 1 from $t where not 1=2;