Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个包含 2 列的表,1 包含汽车,1 包含随机数。如何在表中搜索最新的“法拉利”条目并知道该法拉利的随机数是什么?
我假设您的 Cars 表有列id, name,rnid
id
name
rnid
您可以使用以下sql;
SELECT MAX(c.id) AS latestferrari FROM Cars c INNER JOIN randomnumbers rn ON c.rnid=rn.id WHERE c.name="ferrari"