#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
套红的地方有问题!
你不可能将多个字段赋予一个别名,这在逻辑上是说不通的
那个 * 应该,也只能是一个明确的列名
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号