sql查询in的问题

哎算了 2019-06-09 07:40:41
select * from cx_main where 厂家名称 in (12, 13,14) order by id asc

上面查询没问题, 12,13,14这是企业ID

select * from cx_main where 厂家名称 in (北京..公司, 天津..公司,南京..公司) order by id asc

这样写企业中文名称却不行,但是我也必须用到中文,请问怎么办?
...全文
425 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
xd521 2019-07-19
  • 打赏
  • 举报
回复
select * from cx_main where 厂家名称 in (12, 13,14) order by id asc
这个应该是
select * from cx_main where 厂家ID in (12, 13,14) order by id asc
leisunzhi 2019-07-15
  • 打赏
  • 举报
回复
数据库只要是查询字符类型的都要加单引号
hiphoper 2019-07-13
  • 打赏
  • 举报
回复
ASP_简单的订单查询程序源码 http://bbs.ttasp.com/thread-833-1-1.html (出处: 天天ASP家园)
Dogfish 2019-07-12
  • 打赏
  • 举报
回复
字串要单引号的。
123321... 2019-06-21
  • 打赏
  • 举报
回复
数据库查询,字符串类型要用单引号
  • 打赏
  • 举报
回复
大哥,我就想问一句,你到底是查询ID 还是查询 文字
哎算了 2019-06-09
  • 打赏
  • 举报
回复
我知道了。
select * from cx_main where 厂家名称 in (北京..公司, 天津..公司,南京..公司) order by id asc


改为

select * from cx_main where 厂家名称 in ('北京..公司', '天津..公司','南京..公司') order by id asc


加上单引号就可以了。

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧