Search posts...
select category, sub_category, count(distinct order_id) cnt_orders from records where (customer_id, order_date) in (select customer_id, first_order_date from customer_stats) group by category, sub_category order by 3 desc;
silver