scooter41 Posted July 15, 2008 Share Posted July 15, 2008 Hi there... I have a personal site, that I want to combine the blogs of 2 company sites I run, and display them together in one "multi blog" type page. Is it possible to do a select statement from 2 different tables and 2 different databases and output accordingly? I guess if not I would need to put the 2 outputs of data into an array and then merge them. I wanted them to display in date order so hence the reason for wanting to merge rather than execute one query then the other. Thanks for any help in advance! Link to comment https://forums.phpfreaks.com/topic/114868-merge-data-output-from-2-mysql-databases/ Share on other sites More sharing options...
revraz Posted July 15, 2008 Share Posted July 15, 2008 Of course it's possible, you open it just like the other. They are on the same webhost right? Link to comment https://forums.phpfreaks.com/topic/114868-merge-data-output-from-2-mysql-databases/#findComment-590698 Share on other sites More sharing options...
scooter41 Posted July 15, 2008 Author Share Posted July 15, 2008 Ok I have found out how to select another database in the same select statement, which I have as the following: select * from dreamshock.news, scottwright.news order by dreamshock.news.date But this duplicates each record for both tables so I end up with hundreds of each entry... plus I dont really know how to sort by date on both tables at the same time. Me = confused Link to comment https://forums.phpfreaks.com/topic/114868-merge-data-output-from-2-mysql-databases/#findComment-590823 Share on other sites More sharing options...
discomatt Posted July 15, 2008 Share Posted July 15, 2008 Look into joins Link to comment https://forums.phpfreaks.com/topic/114868-merge-data-output-from-2-mysql-databases/#findComment-590825 Share on other sites More sharing options...
scooter41 Posted July 15, 2008 Author Share Posted July 15, 2008 right... I do understand joins which in an ordinary scenario would be fine... however these 2 tables arent relational in anyway... once is just a copy of the other's structure, but with different content.... hmmmm Link to comment https://forums.phpfreaks.com/topic/114868-merge-data-output-from-2-mysql-databases/#findComment-590871 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.