[wp-trac] [WordPress Trac] #42304: Database joins with like field names

WordPress Trac noreply at wordpress.org
Tue Oct 24 21:51:25 UTC 2017


#42304: Database joins with like field names
-------------------------------------+------------------------------
 Reporter:  vinlandmedia             |       Owner:
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  Database                 |     Version:  4.8.2
 Severity:  normal                   |  Resolution:
 Keywords:  close reporter-feedback  |     Focuses:
-------------------------------------+------------------------------

Comment (by vinlandmedia):

 Thank you for the responses.

 @birgire - that seems reasonable, except when I tried an exact copy of the
 query interactively (using Adminer -- this is from a Local by Flywheel
 test instance) it worked fine.  However, your workaround seems like it
 would solve my issue, and there is certainly nothing wrong with having
 more thorough qualifications in the queries.

 @johnbillion - this is a new plugin I've been working on, and the SQL is
 built in the plugin based on criteria.  The statement executed in the code
 is:

 {{{
 $query_results = $wpdb->get_results($mysql_query);
 }}}

 ...where $mysql_query is variations based on the previously-posted
 statement.

 I will try adding the "as field_name" suggested by @birgire.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42304#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list