On Jan 13, 8:34 pm, mwlang88 <[email protected]> wrote:
> I am having trouble converting a fairly simple update query to
> Sequel's rubyish ways:
>
> update billing_headers bh
>         set bh.total = (
>                 select sum(bd.extended)
>                 from billing_details bd
>                 where bd.billing = bh.billing
>                         and bd.entry_date <= '#{CUTOFF_DATE}'
>                 )

DB[:billing_headers___bh].update(:bh__total=>DB
[:billing_details___bd].select{sum(bd__extended)}.where
(:bd__billing=>:bh__billing).where{bd__entry_date <= CUTOFF_DATE})

Jeremy
-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.


Reply via email to