Reputation: 43
I am trying to pull a query of everyone who opened an email, where the emailname contains the word 'offer'. However,I am getting the error:
Errors: An expression of non-boolean type specified in a context where a condition is expected, near ')'.
SELECT j.Emailname, j.JobID
FROM _Job j
WHERE j.Emailname LIKE 'offer%'
AND (
SELECT o.SubscriberKey, o.JobID
FROM _Open o
WHERE o.JobID = j.JobID
)
Any help would be appreciated. Thanks!
Upvotes: 1
Views: 3518
Reputation: 460138
Well, AND
expects a Boolean
but you give it a sub-query that returns records.
Maybe you want to use EXISTS
(selecting 1
because columns don't matter in EXISTS
/NOT EXISTS
):
SELECT j.Emailname, j.JobID
FROM _Job j
WHERE j.Emailname LIKE 'offer%'
AND EXIST(
SELECT 1
FROM _Open o
WHERE o.JobID = j.JobID
)
Upvotes: 2