0

Assume that I have 2 databases named db1 and db2. For some reasons, our hosting service only allows 1 user per database. I have user1 is administrator of db1, and user2 as the administrator of db2. Here is an example query:

SELECT *
FROM db1.table1, db2.table2
WHERE db1.table1.column1 = db2.table2.column2;

The above SQL works if user1 (or user2) is administrator of both db1 and db2. But in my case, it's not. That's why the SQL doesn't work because user1 doesn't have privilege on db2 and vice versa.

How can I cross-reference between these 2 databases?

Thanks.

  • 1
    If i understand correctly you want to make a join between two tables on 2 diferent databases? If that's the case, the login you use must have select privileges on both databases. You can't avoid that. It doesn't need to be administrator. – ericpap May 28 '14 at 20:44
  • If you can only create one user per database, you should consider changing providers. This is a really odd limit and it totally useless in any system of significant complexity where you want to create specific access controls for different users/applications, which is common practice. – Mike Brant May 28 '14 at 20:54

0 Answers0