2012-05-16 18 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

相關問題