0

I have two Data Extensions - BlogPost and BlogList

BlogPost has three columns

pubdate   | title | sent
---------------------------
3/12/2016 | XYZ   | True
3/15/2016 | ABC   | False

BlogList has two columns -

   email   | send
--------------------
 me@me.com | False
 us@me.com | False

I want to run a SQL Query to update all rows the BlogList 'send' column with value of 'True' if the value of BlogPost last row column 'sent' is equal to False

The two DE's have nothing in common

Really new to SQL and MC as well. So of course this is a complete hack of SQL below and does not work.

SELECT 
L.[email],
L.[send]
 CASE WHEN [BlogPost.sent] ='False' THEN '[BlogList.send = 'True']'
FROM BlogList L
WHERE L.send = 'False'
0

You may be able to do it this way.

This query selects bloglist rows (with true as send) when the most recent blogpost row is false. The action on the Query Activity would be update.

select
l.email
, 1 /* True */ as send
from bloglist as l
outer apply (
   select top 1
     p0.pubdate
   , p0.title
   , p0.sent
   from blogpost as p0
   order by p0.sent desc
) as p
where p.sent = 0 /* False */
  • Thanks Adam. I will give it a try. What I have been struggling with is how to one data extensions update force the action on another, but only if a certain condition is true. As you might tell this is a method I am trying to develop that will handle automatically sending emails to a subscriber DE but based on an external action. I already have a way to update the first DE from an external source. I will give this a whirl and make sure and mark this as answered soon. – Brad Dunzer Mar 23 '16 at 14:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.