sql一个查询问题?关于SQL一个查询问题:select ID from table_name where name = ‘Crohns disease, increa
sql一个查询问题?
关于SQL一个查询问题:
select ID from table_name where name = ‘Crohn's disease, increased risk, association with’
这样显然是有问题的,查询条件中的字符串含有了单引号,那么怎样解决这个问题呢?
谢谢了!
[解决办法]
加多个'
select ID from table_name where name = 'Crohn''s disease, increased risk, association with';
或者用自定义分隔符
select ID from table_name where name = q'<Crohn's disease, increased risk, association with>';
[解决办法]
[解决办法]
两个单引号 '' 可以被数据库理解成为一个字符串的单引号
也可以在 sql语句的结尾用 excape处理
[解决办法]
1楼正解。
[解决办法]
1楼.
[解决办法]
用'' 代替'
[解决办法]
用变量
