-- Carts by Location
-- This report shows total carts for each location
-- FILTER: {
--   filter: "link",
--   column: "link",
--   "params": {
--         "blank": true,
--         "display": "View"
--     }
-- }
-- FILTER: {
--   filter: "link",
--   column: "explore",
--   "params": {
--         "blank": true,
--         "display": "Explore"
--     }
-- }
-- FILTER: {
--   filter: "date",
--   column: "create_date",
--   params: {
--     "format": "m/d/y"
--   }
-- }

Select
       (SELECT name from simplebrsprod.business_location bl where bl.id = dc.location_id) as name,
       dc.location_id, count(*) as total,
       concat('https://simple123.com/business/locations/', dc.location_id) as link
from simplebrsprod.deal_cart dc
WHERE dc.location_id is not null
GROUP BY dc.location_id
ORDER BY total desc
LIMIT 100;