How to write a SQL query from 2 separate databases
Posted on 2011-02-25
I did not search because I don't know exactly how to phrase this. I will present the scenario and ask that someone provide me with an example of what I need or a link to an example.
I have 2 separate oracle databases. I am looking to get data from one table in each database and then provide computed results to a report.
The first table in db 1 is a statistics table, the table in db2 is a corrections table. They will link on username.
The pseudo code for what I want is: Select username, sum(errors) from db2 also select username sum(pagesprocessed) from db1 and both where date_stamp between startdate and enddate provided by a webform. The results will be displayed by username as column 1 and column 2 being the sum(pagesprocessed) / sum(errors).
I have done this in a prior application but I did it by pulling 2 recordsets populating 2 arrays and looping the arrays. I would like to know : 1 is it possible to do in a single query and 2 can someone provide an example or a link to an example. And know that one of the DBs does link to the other DB through a DBLINK. Thanks.