php - Execute multiple SQL queries and sort the output -
currently, i'm working on project requires me execute 2 sql queries, have sort output date , id before writing output of both queries table.
sorting both queries in sql :
order order.date desc, order.id desc.
then appending results in 1 variable gets looped on part of script. executing seperate queries result in 2 blocks of sorted items not sorted when appending results.
what solution data sorted properly?
try use
select a.* ((query1) union (query2)) order a.date desc, a.id desc
Comments
Post a Comment