I know Sequel is pretty powerful, and you can express a lot of different 
queries, but I was wondering if it would be better to just run this query 
as straight SQL, or if it could legibly be converted into Sequel statements.

update period_categories pc 
set activity = cs.activity
from (
  select ti.category_id, sum(ti.amount) as activity 
  from transaction_items ti 
    join transactions t 
      on t.id = ti.transaction_id and t.date >= '2016/12/01' and t.date <= 
'2016/12/31'
  where ti.category_id in (1,2) 
  group by ti.category_id) cs
where cs.category_id = pc.category_id;

The variables in the statement are the dates, and the IN values. Thanks in 
advance.

Steve

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to