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

WordPress Trac noreply at wordpress.org
Mon Aug 12 18:12:56 UTC 2013


#17065: Independent ASC/DESC in multiple ORDER BY statement.
-------------------------------------------------+-------------------------
 Reporter:  ericmann                             |       Owner:  ericmann
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  3.7
Component:  Query                                |     Version:  3.1
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing needs-unit-  |
  tests                                          |
-------------------------------------------------+-------------------------

Comment (by andy):

 Replying to [comment:48 dd32]:
 > Perhaps we'd be best to simply handle `$q['order']` as a default
 ordering, and append a order to every matched item?

 My patch was incorrect.

 What makes it difficult to improve `orderby` is that WordPress defaults to
 `DESC` whereas MySQL defaults to `ASC`.

 I had proposed to treat the new style like MySQL because it seemed natural
 to expect MySQL-like inputs to produce MySQL-like results. But I've
 changed my mind because the old `orderby` style was equally MySQL-like in
 input but could be opposite in output simply by omitting `ASC` and `DESC`.

 It is possible to add `ASC`/`DESC` support to `orderby` without breaking
 back compat but not without making `orderby` confusing and error-prone for
 users.

 So I abandon my previous patch attempting to improve `orderby` and instead
 propose a new query arg called `order_by` which is intended to be MySQL-
 like.

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


More information about the wp-trac mailing list