ylkien Posted March 27, 2007 Share Posted March 27, 2007 Hi guys, I'm trying to get data from DB2 (which has the table "test2"), which will be used in DB1 (which has the table "test1"). I tried the command below, but it doesn't work. Do I need a script? If so, where can I learn it? Select * from test1 where id in ( select id from test2) Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/44463-get-data-from-different-database-using-select/ Share on other sites More sharing options...
marmite Posted April 25, 2007 Share Posted April 25, 2007 I've never seen a cross-DB query before, but have you tried: select * from db1.test1 where id in (select id from db2.test2) ? I presume you'd need to specify the DB which your current code doesn't appear to do Quote Link to comment https://forums.phpfreaks.com/topic/44463-get-data-from-different-database-using-select/#findComment-238564 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.