最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Mysql错误Operand should contain * column解决办法
时间:2022-11-14 23:37:00 编辑:袖梨 来源:一聚教程网
使用了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
)
相关文章
- 极限竞速地平线6:如何开启自动驾驶功能 05-21
- 深海迷航2修理工具蓝图获取途径-修理工具蓝图解锁方法详解 05-21
- 支付宝碰一碰支付操作指南-支付宝碰一碰防套路攻略 05-21
- 实测智象未来hidream.ai的5个隐藏功能,效率翻倍 05-21
- 名将杀法正技能是什么 05-21
- 下一站江湖2机关师身份怎么样 05-21