sql - Get soldats that were send out last week -
lets want know how many soldats send out during last week.
i wrote query returns me how many soldats send out today week, im wondering how soldats send out last week.
my query looks this:
select count(id), sum(case when date(send_out) = current_date 1 else 0 end) today, sum(case when send_out >= date_trunc('day', now()) - interval '6d' 1 else 0 end) this_week soldats i tried add:
sum(case when send_out >= date_trunc('day', now()) - interval '12d' , send_out < date_trunc('day', now()) - interval '6d' 1 else 0 end) last_week but not sure if correct!
how write query?
Comments
Post a Comment