I have two Data Extensions one with a field that contains the name of another data extension
SetUp DE
ID | Audience |
---|---|
01 | bigAudience |
02 | smallAudience |
smallAudience DE
PersID |
---|
00001 |
00002 |
I would like to select the data within the second DE (smallAudience) based on the result that is returned from querying the first DE (Setup)
SELECT
PersID
FROM
(CAST((SELECT TOP 1 a.Audience FROM [Setup] a ORDER BY a.ID DESC) AS CHAR))
In this example, I am attempting to CAST the resultset as a CHAR then return this to the FROM clause, given that only a single value is returned. However this does not seem to work as per error returned
An error occurred while checking the query syntax. Errors: CAST((SELECT is not a known data extension or system data view. You can only query existing data extensions or system data views.
This is all from an activity within Automation studio in Marketing Cloud