0

I am producing this

Inpatient Days NICU rate    
1              900.00

These two columns are listed on different databases on different servers so database a has inpatient days and database b has nicu rate. How do I multiply Inpatient days * Nicu rate and get a new column called total allowed?

Stephen Kennedy
  • 20,585
  • 22
  • 95
  • 108

2 Answers2

1

Here is an example of how to do that https://stackoverflow.com/a/1144070/2560997

Basically just do the next:

select *
from LocalTable, [OtherServerName].[OtherDB].[dbo].[OtherTable]
Community
  • 1
  • 1
Winner Crespo
  • 1,644
  • 15
  • 29
0

If both db in the same server, then the syntax is

select 
    a.quotename[Inpatient Days], b.quotename[NICU rate]    
from 
    databasename.a ,databasename.b
--where condition if there, other wise cartesian product result comes

If both db in different database , then as above suggest use link server syntax.

you can replace this heirarchy by DOT(.)

SQL dot notation

https://dba.stackexchange.com/questions/1166/is-it-okay-to-put-dots-in-sql-server-database-names

Community
  • 1
  • 1
Ajay2707
  • 5,690
  • 6
  • 40
  • 58