左联接表和表中的回声

编程入门 行业动态 更新时间:2024-10-26 20:21:13
本文介绍了左联接表和表中的回声的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试从我的两个表中显示表中的行.我想要来自称为Teacher_profile的表的所有行,并希望来自中心的名称列.我可以在phpMyAdmin中运行查询,并且可以正常运行,但问题是两个表的名称都很常见,因此我无法在表中正确显示centername.因为那里Teacher_profile和center都有name列.我无法重命名它,因为它已经存在并且可以在我的Android应用程序中使用.

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 it's 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

如何从中心获取名称列作为center_name,以便可以在表行中使用它?

How can I get name column from center as center_name in result so I can use it with my table row?

注意:我只想要中心表中的名称列,并且想要获取类似centername的名称,因此查询结果中不会出现多个列名称.

Note: I want only name column from center table and want to get something like centername so there no multiple column name come in query result.

推荐答案

您可以使用完全限定的列名. q.name是teacher_profile中的name列,而a.name是center表中的name列.

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.

更多推荐

左联接表和表中的回声

本文发布于:2023-10-20 22:27:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1512324.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:回声

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!