如果我有多个查询并想在表中显示结果,如何使用服务器端分页?

I have large database data , and I am querying from different tables and want to get results in different arrays after calculations then I want to combine the data and display that in one table ?

Something like that;

$query = select everything from table one ;
$query2 = select userid from $query result;

<?php print Calculation ;?>

$resultant query = select something from another table where date from the above result and userid from $queryone array;

Display in data tables with server side processing ???

Appreciate if anybody help