-- Carts by Prospect Location
-- This report shows total carts for each prospect 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 company_name from simplebrsprod.business_prospect bl where bl.id = dc.prospect_location_id) as name,
       dc.prospect_location_id, count(*) as total,
       concat('https://simple123.com/business/locations/', dc.prospect_location_id) as link
from simplebrsprod.deal_cart dc
WHERE dc.prospect_location_id is not null
GROUP BY dc.prospect_location_id
ORDER BY total desc
LIMIT 100;