Adding sorting and pagination to data from different DB

My task is to take data from different databases in different servers and to display them in a single web page.I am working in joomla and i am able to take data from the databases using separate queries for each database.But the problem is that i need to give sorting and pagination to this web page. how can i do this without making any performance issue since all the databases contains a lot of data.
Or can i use a single sql query for this ??

very difficult to do really…

Is there a particular reason they’re using multiple -servers-?

My requirement is to fetch data from 12 databases located in different servers.These 12 databases is used by other websites.A table is repeating in all these databases.i have to take all the data in those 12 tables and display it in a single list and add pagination and sorting to it.

Is there any method to get data from the databases using XML .