Hi all,

I have two db,
one db "latestdb" which have latest six months records
second db "backupdb" which have oldest records of "latestdb" and this records deleted from "latestdb"

I have a query which should return records from both db. Query will return new records from "latestdb" and old records from "backupdb".
Is it possible to do ,if yes then how?
Please help me.
Thank you.

Recommended Answers

All 4 Replies

You can just reference the databases in your query.

SELECT * FROM database1.table1
UNION
SELECT * FROM database2.table1

Thank you,
My project have lots of query ,i have to change all queries which is not possible.
Is there any tool with execute query on both db?

i have to change all queries which is not possible.

You'll have to change something. Change the query, write a view or stored procedure. You can't get this information just automagically.

If you can change the database connection, a view might be the easiest option.

Thank you,

May be it will solve my problem, I will try by view and let you know.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.