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

WordPress Trac noreply at wordpress.org
Sun Oct 22 12:33:57 UTC 2017


#42305: 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        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Using custom tables, and in this case I have a parent-child relationship.
 The following query works fine interactively:


 {{{
 SELECT wp_books.name, wp_chapters.name FROM wp_books, wp_chapters WHERE
 wp_books.id = wp_chapters.book_id;
 }}}


 In Wordpress (using $wpdb->get_results) the query only returns a single
 column, the latter (wp_chapters.name).

 If I use any other column combination (i.e. not two "name" fields) the
 query works in Wordpress.

 Wondering if this might be a bug.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42305>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list