gpt4 book ai didi

postgresql - Postgres : ERROR: operator does not exist: character varying = bigint

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

我的查询是这样的。我尝试获取 ID 列表的状态。

select order_number, order_status_name
from data.order_fact s
join data.order_status_dim l
on s.order_status_key = l.order_status_key
where
order_number in (1512011196169,1512011760019,1512011898493,1512011972111)

虽然我得到了一个错误:

ERROR:  operator does not exist: character varying = bigint
LINE 6: order_number in (1512011196169,1512011760019,1512011898493,1...
^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

关于我应该如何修改 ID 以使其正常工作,您是否有任何线索?非常感谢!

最佳答案

您的 order_number 是一个 varchar,您不能将它与数字进行比较(123 在 SQL 中是一个数字,'123'是一个字符串常量)

您需要使用字符串文字:

order_number in ('1512011196169','1512011760019','1512011898493','1512011972111')

手册中的更多详细信息:
http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-CONSTANTS

关于postgresql - Postgres : ERROR: operator does not exist: character varying = bigint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34740652/

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