我想从两个表中检索名称

我想从两个表中检索名称

本文介绍了我想从两个表中检索名称。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个表1st是city_master,2nd是成员。

city_master提交的是City_id,City_name

和成员Member_id,Member_name,City_id,Member_address,Native_place(在这个领域我也存储了city_id)



city_id和Native_place都是商店city_id。来自city_master





i想要检索city_name和Native_place(Name)但显示native_place id(city_id)。

但我想显示Native_place名称而不是City_id。



所以如何显示native_name。

请给我查询检索数据回复尽可能。

谢谢

I have two table 1st is city_master and 2nd is member.
city_master filed is City_id ,City_name
and in Member Member_id, Member_name,City_id,Member_address, Native_place(in this field i also stored city_id)

city_id and Native_place both are store city_id. from city_master


i want to retrieve city_name and also Native_place(Name) but display native_place id(city_id).
But i want to display the Native_place Name not City_id.

so how to display native_name.
please give me query of the retrieve data reply as far as possible.
thanks

推荐答案

SELECT m.*, c.City_Name FROM Member m
JOIN city_master c
ON c.City_id = m.City_id


这篇关于我想从两个表中检索名称。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 05:23