欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

#1241 - Operand should contain 一 column(s)

程序员文章站 2022-04-13 13:49:59
...
#1241 - Operand should contain 1 column(s)
SELECT o . * , (
SELECT count( * )
FROM purn_order_product AS op
WHERE op.op_oordernum = o.o_num
) AS op_cnt, (

SELECT *
FROM purn_order_product AS op
INNER JOIN purn_product AS p ON ( p.p_it = op.op_pcode )
WHERE op.op_oordernum = o.o_num
ORDER BY op.op_uid ASC
LIMIT 1
) AS p_info
FROM purn_order AS o
ORDER BY o_rdate DESC
LIMIT 0 , 50

请问一下,
上面的SQL语句,提示出错:
#1241 - Operand should contain 1 column(s)
这个怎么解决?
请详细一些。
谢谢
------解决思路----------------------
SELECT o . * ,
(SELECT count( * ) FROM purn_order_product AS op WHERE op.op_oordernum = o.o_num) AS op_cnt,
(SELECT * FROM purn_order_product AS op INNER JOIN purn_product AS p ON ( p.p_it = op.op_pcode )
WHERE p.op_oordernum = o.o_num ORDER BY op.op_uid ASC LIMIT 1 ) AS p_info
FROM purn_order AS o
ORDER BY o_rdate DESC
LIMIT 0 , 50

套红的地方有问题!
你不可能将多个字段赋予一个别名,这在逻辑上是说不通的
那个 * 应该,也只能是一个明确的列名
#1241 - Operand should contain 一 column(s)

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频