I am looking to automate an IP Warm Up process. We have our plan that defines the number of contacts that should be sent to on each day across each domain group.
I would like to automate this, so am looking at how I can create a dynamic Top() clause that will select the correct number of contacts to push into a Send DE each day based on the plan.
DE: Warm_Up_Plan
Fields: Domain_Group | Volume | Send_Date
Example: Gmail | 400 | 9/11/2023 12:00:00 AM
DE: Gmail_Group_Contacts DE
Fields: Id | Email | Domain_Group
Example: 001 | [email protected] | Gmail
Send_Out DE
Fields: Id
The automation should look at the record in Warm_Up_Plan with today's date and the correct domain, and then select that many people from the Gmail_Group_Contacts. I have tried doing something like the below SQL query, however it errors with the message:
SELECT TOP (w.volume) g.id FROM Gmail_Group_Contacts g
INNER JOIN Warm_Up_Plan w
on w.Domain_Group = g.Domain_Group
WHERE w.Send_Date = '9/11/2023 12:00:00 AM'
AND w.Domain_Group = 'Verizon'
Error Message: The reference to column "volume" is not allowed in an argument to a TOP, OFFSET, or FETCH clause. Only references to columns at an outer scope or standalone expressions and subqueries are allowed here.
How can I make the Top() clause dynamic so that it pulls through the value in this manner?