简体   繁体   English

错误代码:1241操作数应包含1列mysql

[英]error code : 1241 Operand should contain 1 column(s) mysql

SELECT t1.loginid,t1.`company_name`,t1.`FA_Name`,t1.`Lot`,t1.`PurchasePrice` FROM test_report t1
WHERE PurchasePrice IN (SELECT t1.loginid,t1.`company_name`,t1.`FA_Name`,t1.`Lot`,MAX(t1.`PurchasePrice`) FROM test_report t1 GROUP BY lot)
ORDER BY lot;

Giving error Operand should contain 1 column(s) 提供错误操作数应包含1列

Trying to fetch the appropriate loginid , company name , fa_name by grouping the lot and get max purchaseprice. 尝试通过对批次进行分组来获取适当的loginid,公司名称和fa_name,并获得最高购买价。

Please help. 请帮忙。 Thanks in advance 提前致谢

Your subselect can only have one value in select clause: 您的subselect在select子句中只能有一个值:

SELECT t1.loginid,t1.`company_name`,t1.`FA_Name`,t1.`Lot`,t1.`PurchasePrice` FROM test_report t1
WHERE PurchasePrice IN (SELECT MAX(t1.`PurchasePrice`) FROM test_report t1 GROUP BY lot)
ORDER BY lot;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM