join
导致错误:
错误:列“ my_ae_actual”不存在 第1行:从MY_Data_Details中选择AVG(MY_AE_Actual) ^ 提示:也许您打算引用“ my_data_details.my_ae_actual111”列。 **********费勒**********
错误:列“ my_ae_actual”不存在 SQL状态:42703 Hinweis:也许您打算引用“ my_data_details.my_ae_actual111”列。 蔡晨:12
更新
这很奇怪。我现在在PostgreSQL 10中使用下表进行了测试:
SELECT AVG(MY_AE_Actual) FROM MY_Data_Details
CREATE TABLE public.testable
(
id integer NOT NULL DEFAULT nextval('testable_id_seq'::regclass),
string_data1 character varying(255) COLLATE pg_catalog."default",
"String_Data2" character varying(255) COLLATE pg_catalog."default",
"string_Data3" character varying(255) COLLATE pg_catalog."default",
"String_data4" character varying(255) COLLATE pg_catalog."default",
CONSTRAINT testable_pkey PRIMARY KEY (id)
)
-成功
select string_data1 from testable
-成功
select String_data1 from testable
-成功
select string_Data1 from testable
-成功
select String_Data1 from testable
-成功
select "string_data1" from testable
-失败
select "String_data1" from testable
-失败
select "string_Data1" from testable
-失败
select "String_Data1" from testable
-失败
select string_data2 from testable
-失败
select String_data2 from testable
-失败
select string_Data2 from testable
-失败
select String_Data2 from testable
-失败
select "string_data2" from testable
-失败
select "String_data2" from testable
-失败
select "string_Data2" from testable
-成功
事实证明,不带引号的PostgreSQL并非“不区分大小写”,而是“小写”,完全没有意义。
答案 0 :(得分:1)
除非使用双引号,否则Postgresql强制使用小写
ThisFieldName == thisfieldname
但是:
"ThisFieldName" <> ThisFieldName
"ThisFieldName" <> thisfieldname
如果您像"ThisFieldName"
这样创建字段,则需要引用相同的字段。
在您的情况下,您尝试使用MY_AE_Actual
,但postgresql告诉您my_ae_actual
名称不存在。
用Sames作为表名。
我的建议在Postgresql中不要使用大写字母。我将所有小写的下划线_
用作分隔符。但这只是个人喜好。