← All projects
Amstrad Mobile: SQL-Powered Upsell Campaign
An upgrade campaign where SQL does the personalization up front: two upgrade options per customer, the price and data difference, a recommended plan and a personal link.
01 · The result
What it produced
02 · How I built it
The logic, in plain English
- Joined CustomerBase to the Plan Matrix three times to get the current plan, Upgrade A and Upgrade B in one query.
- Calculated the extra data and the monthly price difference for both options.
- A
CASEpicks the recommended plan from each customer's 90-day data usage. - Excluded inactive, opted-out and low-ARPU customers and blocked plans, then wrote everything to a sending Data Extension so the email needs very little AMPscript.
Built and run in an SFMC sandbox. The journey was configured, no live send.
03 · Under the hood
One plan matrix, joined three ways
A short excerpt. The full code and the brief's requirements are on GitHub.
SQLUpsell_Sending.sql
/* UPGRADE A - DATA AND PRICE DIFFERENCE */ (A.DataGB - PM.DataGB) AS UpgradeA_DataDiff, (A.Price - PM.Price) AS UpgradeA_PriceDiff, /* RECOMMENDED PLAN BASED ON DATA USAGE */ CASE WHEN CB.AvgDataUsageGB90 > A.DataGB THEN B.PlanID ELSE A.PlanID END AS RecommendedPlan FROM [CustomerBase] CB INNER JOIN [PlanMatrix] PM ON CB.LastPlanID = PM.PlanID /* CURRENT PLAN */ INNER JOIN [PlanMatrix] A ON PM.UpgradeA_PlanID = A.PlanID /* UPGRADE A */ INNER JOIN [PlanMatrix] B ON PM.UpgradeB_PlanID = B.PlanID /* UPGRADE B */ WHERE CB.LifecycleStatus = 'Active' AND CB.EmailOptIn = 1 AND CB.ARPU >= 10 AND PM.PlanID NOT IN ('P120', 'P145', 'P098', 'P119')


