【发布时间】:2017-02-10 23:44:25
【问题描述】:
我这里有一个可用的 sqlite 数据库 => https://www.dropbox.com/s/9cn093ns3ot2cik/drinks.db?dl=0
我正在尝试使用来自glasses.name 的正确名称显示(或替换?)drinks.glass_id
我试过了
select drinks._id DID,
drinks.glass_id GID,
glasses.name GNAME,
glasses._id GIDD
from drinks DRNKS
join glasses GLS
on drinks.glass_id = glasses._id
怎么了??
我花了几个小时来查找这个。
我已经阅读了这些链接,但仍然无法弄清楚。
http://community.spiceworks.com/topic/242166-sql-query-help-convert-category-id-to-the-text-name
Replacing a pulled SQL ID value with its name from another table
How to replace fetched values with another column while querying with SQL Server 2008 R2
how to get name from another table with matching id in another table?
【问题讨论】:
-
怎么了?你有错误吗?