SELECT CASE WHEN t.sub_type="online" THEN "Online" ELSE "Offline" END channel,COUNT(t.id) transactions,SUM(t.final_total) total_sales FROM transactions t WHERE t.type="sell" AND t.status="final" GROUP BY CASE WHEN t.sub_type="online" THEN "Online" ELSE "Offline" END;