Q:

wordpress display date table with inner join and the same variable

Good morning,
In a wordpress page I need to display 2 fields at the same time.
The problem is that I don't know how to display these 2 fields  which have the same title field. 
These 2 fields are called "name" in the my sql table of Wordpress and are in 2 separate table. 
I need to display the name of a book and the name of the writer of the book. So I use INNER JOINto do the link between the two tables but after that I don't know how to display these 2 fields.
<?php global $wpdb; $result = $wpdb->get_results
( "SELECT * FROM wp_a INNER JOIN wp_b ON wp_b.id=wp_a.id;"); foreach($result as $row) 
{ echo $row->id."  ".$row->name."  ".$row->name."  ".$row->age."   ; }
?>

How to distinguish ".$row->name." the name of the book  and ".$row->name." the writer name ?
Does it exist something like that : $row->wp_a.name and $row->wp_b.name ?
Any ideas ?

A:

Select the columns you want with an alias   
SELECT wp_a.name AS a_name FROM wp_a 

and you can get the value like
 $row['a_name']

likewise you can select fields from second table

