问题
I am new in PHP and MYSQL database. I am trying to display row in table from my two table. I want all row from table called teacher_profile and want name column from center. I am able to run query in phpmyadmin and its working fine but issue is both table have name is common so I am not able to properly display centername in my table. because there teacher_profile and center both have name column. I can not rename it because its live and used with my android application.
select *
from teacher_profile q
left outer join center a on a.id = q.centerId
ORDER BY q.id DESC
My Query is like this, Let me know if someone can help me out from the issue and so I can get name column from center as center_name in result so I can use it with my table row. Thanks a lot!
Note : I want only name column from center table. and want get something like centername so there no multiple column name come in query result. Thanks
回答1:
You can use fully qualified column names. q.name
is the name
column from teacher_profile
and a.name
is the name
column from the center
table.
来源:https://stackoverflow.com/questions/54873471/left-join-table-and-echo-in-table-mysqli-query