gpt4 book ai didi

php - #1241 - 操作数应包含 1 列 : why?

转载 作者:行者123 更新时间:2023-11-29 23:31:41 24 4
gpt4 key购买 nike

我想在主查询中使用子查询,如下所示:

SELECT distinct(cnt.crid),cu.companyName,m.*,cnt.*,m.submitDate as mSubmitDate 
from tbl_mahmoleh m,tbl_customer cu,tbl_cntreserve cnt
where m.cuID=cu.cuID and m.mBLID=cnt.mBLID and m.cuID='12'
and (cnt.crID IN (SELECT DISTINCT(crID) FROM tbl_paymentcnt))
and (cnt.crID IN (SELECT pc.crID, SUM( amount ) AS PaySum
FROM tbl_paymentcnt pc GROUP BY pc.crID HAVING PaySum < '2000'))
ORDER BY inputDateD

但是我遇到了这个错误

Blockquote #1241 - Operand should contain 1 column(s)

最佳答案

我明白了,IN 子句不能用于多个字段,我将查询更改为以下内容,我的问题得到了解决。

SELECT DISTINCT(cnt.crid),cu.companyName,m.*,cnt.*,m.submitDate AS mSubmitDate 
FROM tbl_mahmoleh m,tbl_customer cu,tbl_cntreserve cnt
WHERE m.cuID=cu.cuID AND m.mBLID = cnt.mBLID AND m.cuID = '12'
AND (cnt.crID IN (SELECT DISTINCT(crID) FROM tbl_paymentcnt))
AND (cnt.crID IN (SELECT pc.crID FROM tbl_paymentcnt pc GROUP BY pc.crID HAVING SUM(amount) < '2500'))
ORDER BY inputDateD

关于php - #1241 - 操作数应包含 1 列 : why?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26526476/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com