如何将数据与不同的数据库进行比较 [英] how to compare data with different databases

查看:121
本文介绍了如何将数据与不同的数据库进行比较的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家下午好,



i试图从database1中的table1获取数据,这些记录不在另一个数据库的另一个表中。我在下面的示例查询中尝试过。 pre lang =c#> 选择 * 来自 database1.table1 其中 column1 select column1 来自 database2.table2 其中 order_date> sysdate-1)



上面的示例查询不是工作。

如何通过比较另一个数据库中的另一个表数据从表中获取数据。

解决方案

也许:

select * from database1.table1其中to_char(column1,'DD-MM-YYYY')不在(从database2.table2中选择to_char(column1,'DD-MM-YYYY'),其中order_date> sysdate-1)



和检查db2是否可以从db1接收,即GRANT SELECT TO DB2.Table2 ON DB1


(选择*从T1减去选择*从T2)

union所有

(从T2中选择*减去从T1中选择*);


hi all good afternoon ,

i have tried to fetch data from table1 in database1 those records not in another table in another database.i tried below sample query.

select * from database1.table1 where column1 not in(select column1 from database2.table2 where order_date>sysdate-1)


the above sample query is not working.
how can i get data from table by comparing another table data from another database.

解决方案

maybe :
select * from database1.table1 where to_char(column1, 'DD-MM-YYYY') not in (select to_char(column1, 'DD-MM-YYYY') from database2.table2 where order_date>sysdate-1)

and check that db2 can be accesed from db1, that is GRANT SELECT TO DB2.Table2 ON DB1


(select * from T1 minus select * from T2)
union all
(select * from T2 minus select * from T1);


这篇关于如何将数据与不同的数据库进行比较的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆