#1241 - Operand should contain 一 column(s)
程序员文章站
2024-02-08 00:02:40
...
#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
套红的地方有问题!
你不可能将多个字段赋予一个别名,这在逻辑上是说不通的
那个 * 应该,也只能是一个明确的列名
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
套红的地方有问题!
你不可能将多个字段赋予一个别名,这在逻辑上是说不通的
那个 * 应该,也只能是一个明确的列名
相关文章
相关视频