SELECTing across multiple DB2 databases in one query -


Ive running on this issue where I need to ask 2 different databases (same instance) in a query .
I used to do it with mysql, but I'm sure how to do it with DB2.

MySQL will do something like this:

  SELECT user_info. *, The game * User_info, second_db.game_stats as the game WHERE user_info.uid = game.uid   

So the question is how do I translate a query into DB2 syntax ?

Do you have any reason for tables in different databases? MySQL does not support the concept of schema, because "schema" is similar to a "database" in MySQL. In DB2, the schema is a collection of named objects that group you together.

In DB2, a database is close to a complete MySQL server because each DB2 database can have multiple schemas. With many schemas within the same database, your query can make writing more or less unchanged.

However, if you actually have 2 different DB2 databases (and, for some reason, to migrate to a database with multiple schemas): You can define a nickname in your first database It can

to define a mask ( crawler ), a server ( CREATE SERVER ), user mapping (<) Some complex procedures are needed ( create user mapping ) and in the end Nickname ( create NICKNAME ). Using these control centers GUI, these tasks are easy to do because it will run through the process of defining each of them.

Comments