Hi!
I have a project that needs to select / join from tables that reside in separate Database Connections. In the query browser, I can select from the various tables, from each DB, when the “connection” dropbox has the proper database connection selected. For instance, when the “SQLServer” connection is selected, I can do a select * from productmixsyspro (a table that resides in the SQLServer DB connection). I can’t select * from MixJobs which is defined on a different DB connection without selecting the correct DB connection (SysproScadaInterface).
What I need to do is have a select statement that can join data between these two connections…
As an example:
Select s.sysprojob,s.volrequired,s.RemainingNeed,s.datetostart from
(Select ss.sysprojob,ss.volrequired,(ss.volrequired - coalesce(sum(pm.batchsize),0)) as RemainingNeed,ss.datetostart
from SysproScadaInterface.dbo.sysproschedule ss left outer join SQLServer.dbo.productmixsyspro pms on ss.sysprojob = pms.sysprojob
left outer join SQLServer.dbo.productmix pm on pm.id = pms.productmixid
where ss.datecancelled is null and ss.recipeid = {Root Container.id} group by ss.sysprojob,ss.volrequired,ss.datetostart) as s
where s.RemainingNeed >0
The table sysproschedule resides in a database defined by the connection SysproScadaInterface
The table productmixsyspro resides in a database defined by the connection SQLServer.
Any thoughts, comments, “how to examples” would be greatly appreciated!
Thanks in advance,
Chris