= ? and or."/> = ? and or."/> = ? and or"/>
I have a table that holds order information from customers. When I do this:
@orders = Order.where("order_date >= ? and order_date <= ?", start_date, end_date).sum :total
..i get a different total than when I do this:
@order_total = 0
@orders = Order.where("order_date >= ? and order_date <= ?", start_date, end_date)
@orders.each do |o|
@order_total = @order_total + o.total
end
Any idea why that might be? I am using the exact same records and dates for both.
برچسب:
نویسنده: استخدام کار