2009年6月12日金曜日

合計

今日のpriceの合計
Model.sum(:price, :conditions => ["date_at >= ? and date_at <= ?",Time.now.beginning_of_day, Time.now.end_of_day])
今月のpriceの合計
Model.sum(:price, :conditions => ["date_at >= ? and date_at <= ?",Time.now.beginning_of_month, Time.now.end_of_month])

0 件のコメント:

コメントを投稿