gpt4 book ai didi

WHERE 子句中的 SQL IN 运算符

转载 作者:行者123 更新时间:2023-11-29 11:33:06 26 4
gpt4 key购买 nike

以下查询:

SELECT SUM (peak_power) FROM t_mpi_pv WHERE info_id IN ( 
SELECT mp_info_id FROM t_mp WHERE mp_id IN (
ARRAY[29800001,29800008,29800015,29800022,29800029]
)
)

不起作用。我收到错误:

"Operator does not exist: integer = integer[]".

但是

SELECT SUM (peak_power) FROM t_mpi_pv WHERE info_id IN ( 
SELECT mp_info_id FROM t_mp WHERE mp_id = 29800001
)

有效。

我做错了什么?

最佳答案

尝试:

SELECT SUM (peak_power) FROM t_mpi_pv WHERE info_id IN ( 
SELECT mp_info_id FROM t_mp WHERE mp_id IN
(29800001,29800008,29800015,29800022,29800029)
)
)

关于WHERE 子句中的 SQL IN 运算符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4049879/

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