I have several select statements from different tables in the same database. I used several separate requests, then loaded my array and sorted (again, after ordering in the request).
I would like to combine in one operator to speed up the results and simplify the "load more" (see below).
Each query uses the SELECT, LEFT JOIN, WHERE, and ORDER BY commands, which are not the same for each table.
I may not need the order in each of the statements, but I want the end result to be ordered by field representing the time (not necessarily the same field name in all tables).
I would like to limit the total query results to a number, in my case 100.
Then I use a loop through the results and for each row that I test, if OBJECTNAME_ID (i.e. comment_id, event_id, upload_id) isset then LOAD_WHATEVER_OBJECT, which takes a row and pushes the data into an array.
I do not have to sort the array after that, because it was loaded in order via mysql.
Later in the application, I will βload moreβ by skipping the first 100, 200 or any other page * 100 and again at 100 again with the same request.
The end result from the database will look like "this":
RESULT - selected fields from the table - the field for sorting is larger RESULT - selected fields from the field that is possibly different from another, to sort further RESULT - selected fields from possibly another table of the table - the field for sorting is the third largest etc, etc
, .
.