sql - Multiple Counts Over Multiple Dates -
i doing following query (edited):
select count(orders) orders_table order_open_date<=##/##/#### , order_close_date>=##/##/####
where ##/##/##### same date. in essence number of 'open' orders given day. wanting same count every single day year , don't want write separate query each day whole year. i'm sorry simple new sql , guess don't know how search answer question since searches have come nothing. can offer.
why not
select order_date, count(orders) orders_table group order_date
and last year
select order_date, count(orders) orders_table order_date > date_sub(curdate(), interval 1 year) group order_date;
Comments
Post a Comment