php - Suggestions on retrieving related data across databases with different logins? -


I have an array of user IDs in a query from Database A, Table A (AA).

I have the main user database in Database B, Table A (BA).

For each user ID returned in my result array from AA, I will name that user ID from first and last BA.

Different user accounts control each database. Unfortunately, not every login can be allowed for each database.

Q: How can I get the first and at least live with the questions and / or processing time? With 20 users in the array? With 20,000 users in the array?

P> Until the database is on the same server, just a Use Cross Databases. DB login, which is used to access data, will also need permission on both databases. Something like this:

SELECT AA.userID, BA.first, BA.last FROM databasename.schema.table AA Inner Job databasename.schema.table BA on AAUUZID = BA. AnswerID:

In response to comments:

I do not believe I have read many logins correctly, sorry . You can not use two different MySQL logins on one connection. If you need to do many queries, then in fact you have only three options: a) First run loop and multiple queries through the result set. B) Run a query using a WHERE clause with UserID in (@Fast Resetset) and pass it in the first result set. C) Select everything from the other DB and include them in the code.

All those three options are not very good, so I will ask, why can not you change the user permission on one of two DBS? I will also ask why, why would you have to choose the names and ID of 20,000 users? Unless it's some kind of data dump, I'm looking for a different way to display data that would be both easy to use and less query-intensive.

Everyone said, I use option B, with less than 1,000 records depending on the different options you choose. With a large number of records, I would probably use the C option and try to set two result sets in something that can be added (such as using array_combine)

< / Html>

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -