sql server - How to Query 2 SQL databases and compare results -
i have 2 separate sql server databases i'd query , compare results.
for example:
db1
select * customers dtcreated > @startdate
this query give me list of customers created after specific date.
i take results above, , query database (db2) tell me of above query customers still active.
something like:
db2
select * customers bactive = 'true' (and exists in db1 query)
is there way this?
output:
number of records db1 number active in db2 155 67
you can cross-database queries specifying databasename , schema + table name.
select * customers b bactive = 'true' , exists (select 'x' database1.dbo.customers a.dtcreated > @startdate , a.key = b.key)
i'm sorry i'm bit confused example querys , example output. using technique can count way like
Comments
Post a Comment