【发布时间】:2014-07-10 04:03:57
【问题描述】:
我一直在使用inner join 加入三个表。现在我最终得到的是一个连接表,其中两个列名相同并且它们具有不同的数据。一个包含位置名称,另一个包含作物名称。现在我如何访问位置名称。
我的生产表如下:
我的作物表如下:
MY位置表如下:
我的sql查询如下:
Select * from production AS cust
INNER JOIN location AS comp ON cust.location_id = comp.location_id
INNER JOIN crops AS crop ON cust.crop_id=crop.crop_id
where cust.year_of_production =2004 AND crop.name="paddy"
执行sql查询后的输出如下: 这里有两个 columnname 作为 name 。我想访问包含 taplejung 的名称。我不想要名称包含水稻的列。我怎么做
【问题讨论】:
-
代替
SELECT *,命名所有你想要的列...
标签: mysql