gpt4 book ai didi

php - MYSQL - 错误代码 :- 1241 "Operand should contain 1 column(s) "

转载 作者:行者123 更新时间:2023-11-29 07:59:36 25 4
gpt4 key购买 nike

我正在做一个项目。
我有以下查询

select sid, reading, (
select customer_id as cid, sub_location_id as location_id
from customer_information where sub_location_id = 1)
from customer_consumption
where customer_consumption.customer_id = customer_information.customer_id
and month(bill_date) = month(now())

帮助解决这个问题

最佳答案

您似乎想要显式加入:

select cc.sid, cc.reading, 
ci.customer_id as cid, ci.sub_location_id as location_id
from customer_consumption cc join
customer_information ci
on cc.customer_id = ci.customer_id
where month(bill_date) = month(now()) and ci.sub_location_id = 1;

你原来的语法是非常不正统的。您似乎需要进一步了解如何使用 SQL。

关于php - MYSQL - 错误代码 :- 1241 "Operand should contain 1 column(s) ",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24203934/

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