2012-05-16 19 views
0

也有类似的帖子,但没有人帮我解决了我的问题。Postgresql列未找到,但显示在描述

我想在表上做一个简单的选择,只检索一列。该列显示在描述表中,但是当我尝试选择它时,我得到一个未找到列的错误。我正在使用命令行界面。

表:

id      | integer     | not null default 
amazon_payment_id   | integer     | not null 
source     | character varying(10) | not null 
timestamp     | timestamp with time zone | not null 
status     | character varying(50) | not null 
statusReason    | character varying(100) | not null 
transactionId    | character varying(50) | not null 
transactionDate   | timestamp with time zone | 
transactionAmount   | numeric(6,2)    | 
errorMessage    | character varying(100) | not null 

选择:

select `transactionAmount` from ... where ... group by transactionAmount; 

错误:

ERROR: column "transactionamount" does not exist 
LINE 1: select `transactionAmount` from ... where... 

有没有人有任何想法,为什么我会收到此错误?

回答

2

为什么在列名中使用`

您可以不使用任何引号字符来使用它,而使用引号字符时可能区分大小写。同样,这种报价char是",而不是`

所以使用:

select "transactionAmount" 
from ... 
where ... 
group by "transactionAmount"; 

阅读有关的标识符:http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html

+0

谢谢。我试过最后一招,我没有想到双引号。双引号固定它给我。 – hgolov

相关问题