[wp-trac] [WordPress Trac] #17065: Independent ASC/DESC in multiple ORDER BY statement.

WordPress Trac wp-trac at lists.automattic.com
Wed Apr 6 17:11:02 UTC 2011


#17065: Independent ASC/DESC in multiple ORDER BY statement.
-------------------------+-----------------------------
 Reporter:  ericmann     |      Owner:  ericmann
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Query        |    Version:  3.1
 Severity:  trivial      |   Keywords:  needs-patch
-------------------------+-----------------------------
 WP_Query supports ordering results by multiple columns, but does not
 currently support independent ASC/DESC declarations on those columns.
 Instead, it concatenates the ORDER and ORDER BY statements together.

 In some cases, it would be beneficial to independently set the order for
 these columns.  An example offered on WP-Hackers:

 > I have a situation where I want to order a list of post both by author
 and date using WP_Query which isn't a problem since 'orderby' lets me do
 that. But I want the author part sorted ascending and date part sorted
 descending.

 A normal MySql statement would end with `ORDER BY author ASC, date DESC`.

 We should extend WP_Query to allow users to set their ordering parameters
 independently.  This should be done in such a way as to not break
 backwards compatibility.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/17065>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list