Left Join Table and Echo in Table - MySQLi Query

谁都会走 提交于 2020-01-05 07:20:30

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!