1
我正在處理ROR應用程序,並且我使用帶有PostgreSQL數據庫的Hstore,並且問我是否可以通過我的表上的Hstore鍵進行組?Group by Hstore在PostgreSQL和ROR應用程序中鍵入
我這樣做:
select state , count(*) from infractions group by details -> 'commune';`
,但我得到這個錯誤:
column "infractions.state" must appear in the GROUP BY clause or be used in an aggregate function
細節是Hstore列,她是我的細節的例子:
"adress"=>"", "commune"=>"14", "province"=>"6", "description"=>"Ce fichier est sous licence Creative Commons"
感謝
檢查錯誤消息:列「違規.state「必須出現在GROUP BY子句中。你必須先解決這個問題。 –
謝謝,但我怎麼能解決這個問題? –
「狀態」必須是組中的一部分,它在您的選擇中沒有聚合函數。 –