tags:

views:

20

answers:

0

I am building a view and I am having a bit of an issue with in this view.

In the view I need to query 1 database and table to pull the datasource for another database and set the result as a variable. Then I need to use that variable to query a separate database.

Here is my current code:

set @remoteDatasource = 
(
    SELECT
        name
    FROM
        comData.communityDatasource
    WHERE 
        communityID = 1
);


    select
     @remoteDatasource.persons.pid
    FROM
     @remoteDatasource.persons
    LIMIT 10;