2012年4月27日金曜日

HerokuのSQLでは別名をつける際にasをつけないとエラーが出る。

ActiveRecord::StatementInvalid (PGError: ERROR: syntax error at or near "high_price" 2011-10-30T09:02:04+00:00 app[web.1]: LINE 1: SELECT MAX(high_price) high_price,created_on FROM "exchange...
悪いSQL
SELECT  MAX(high_price) high_price,created_on FROM "exchange
いいSQL
SELECT  MAX(high_price) as high_price,created_on FROM "exchange

0 件のコメント: