Mysql语句报错Operand should contain * column解决办法
2016-03-24 11:28
681 查看
Mysql错误问题各种各样的今天 在维护一个网站时碰到Mysql错误Operand should contain * column,下面一起来看问题解决步骤。
使用了sql语句处理某些内容。当执行某个语句时,Mysql报错误:Operand should contain 1 column
字面意思是,需要有1个数据列。
我的sql语句类似这样:
update cdtable set cdcontent=’cd is a good boy’ where id in(
select * from(
select * from cdtable where cdtype in(1,2,3) order by id desc limit 100
)as cd
)
虽然错误的字面意思是缺少列,但是究竟是哪里缺少了列呢?
经过测试,发现是在加上最外层的sql语句之后报的错
仔细看了一下语句,发现在上面语句的蓝色部分“where id in(~~~)”,子查询使用了(select * ~~)子查询得到的是不止一列的数据记录
而很明显,where id in 需要的条件数据是一个列,问题就发生在这里啦
解决的方法是:把where id in(~~)括号内的第一层子查询的“*”改成“id”即可,改后的句子就像:
update cdtable set cdcontent=’cd is a good boy’ where id in(
select id from(
select * from cdtable where cdtype in(1,2,3) order by id desc limit 100
)as cd
)
原文链接:http://www.111cn.net/database/mysql/80875.htm
使用了sql语句处理某些内容。当执行某个语句时,Mysql报错误:Operand should contain 1 column
字面意思是,需要有1个数据列。
我的sql语句类似这样:
update cdtable set cdcontent=’cd is a good boy’ where id in(
select * from(
select * from cdtable where cdtype in(1,2,3) order by id desc limit 100
)as cd
)
虽然错误的字面意思是缺少列,但是究竟是哪里缺少了列呢?
经过测试,发现是在加上最外层的sql语句之后报的错
仔细看了一下语句,发现在上面语句的蓝色部分“where id in(~~~)”,子查询使用了(select * ~~)子查询得到的是不止一列的数据记录
而很明显,where id in 需要的条件数据是一个列,问题就发生在这里啦
解决的方法是:把where id in(~~)括号内的第一层子查询的“*”改成“id”即可,改后的句子就像:
update cdtable set cdcontent=’cd is a good boy’ where id in(
select id from(
select * from cdtable where cdtype in(1,2,3) order by id desc limit 100
)as cd
)
原文链接:http://www.111cn.net/database/mysql/80875.htm
相关文章推荐
- BNP Paribas Cardif Claims Management
- 0c-33-@class,循环retain
- Mac 下安装及配置 ProxyChains-NG 实现终端下代理
- Error creating bean with name 'contentTypeAdminController': Injection of autowired dependencies fail
- AIO
- Traits
- LeetCode Algorithms #24 <Swap Nodes in Pairs>
- Alluxio源码分析定位策略:最大可用容量优先策略MostAvailableFirstPolicy
- Blockchain概述--转
- high availability numbers
- AIX errpt命令说明
- 命令行参数 main()函数设计
- 70. Climbing Stairs
- hdoj-2523-SORT AGAIN
- Aidl 实现进程之间的通讯
- 我与小娜(41):人工智能辅助写作
- rman报错问题 RMAN-03002: failure of recover command
- keychain
- Gradle sync failed: Plugin is too old,
- 处理file_put_contents failed to open stream