specify sort direction for each column in ORDER BY clauses
Created by: cotto
Without this fix, any queries that contain multiple fields in their ORDER BY clause will only have the last field ordered in a non-default direction. This isn't useful because generally the first field is the most important.
My particular use case was to create a list of the 10 most-recently-edited pages using the query below. Without this fix, DPL's orderby doesn't have any apparent effect.
DPL:
{{#dpl:
|namespace=
|allowcachedresults=false
|ordermethod=lastedit
|order=descending
|allrevisionssince=2017-01-01
|debug=0
|count=10
}}
SQL (ORDER BY is at the end of the query):
SELECT DISTINCT rev.rev_timestamp,rev.rev_id,`page`.page_namespace AS `page_namespace`,`page`.page_id AS `page_id`,`page`.page_title AS `page_title` FROM `revision` `rev`,`page` WHERE (`page`.page_id = rev.rev_page) AND (rev.rev_timestamp = (SELECT MAX(rev_aux.rev_timestamp) FROM `revision` AS rev_aux WHERE rev_aux.rev_page = rev.rev_page)) AND `page`.page_is_redirect = '0' AND `page`.page_namespace = '0' AND (`page`.page_id = rev.rev_page) AND (rev.rev_timestamp >= '20170101000000') ORDER BY rev.rev_timestamp,rev.rev_id DESC LIMIT 10