0
我在從單列調用中獲取值時遇到問題。從查詢中獲取價值
select sum(price) as testPrice from sales where quantity > 10
,但是當我檢查結果集,我得到以下,
[#"5"}>]
任何幫助表示讚賞,謝謝。
我在從單列調用中獲取值時遇到問題。從查詢中獲取價值
select sum(price) as testPrice from sales where quantity > 10
,但是當我檢查結果集,我得到以下,
[#"5"}>]
任何幫助表示讚賞,謝謝。
這是一個非常奇怪的結果。我很好奇你爲什麼不使用ActiveRecord方法編寫查詢:
@testPrice = Sale.sum(:price, :conditions => "quantity > 10")
非常感謝!剛剛一直有ActiveRecord的問題,嘆了一口氣,但再次感謝你 – user211662 2009-12-09 02:22:59
嘿,沒關係。那麼這是否解決了您的問題? – 2009-12-09 02:27:50
是的,它的確如此。是否有任何你知道的API,比如noobkit.com(曾經工作過) – user211662 2009-12-09 02:30:06