选择一个值,该值是id等于另一个表的最大值
SELECT colour
FROM party_details WHERE (party_id) IN ( SELECT MAX('p_percentage') FROM colombo )
我有2个表,即:party_details 科伦坡
我需要从party_details中选择颜色(列名称:color),其中颜色是科伦坡表的最大值(列名称:p_percentage)
答案 0 :(得分:1)
这是您想要的吗?
select pd.color
from party_details pd
where pd.party_id = (select c.party_id
from colombo c
order by c.p_percentage desc
limit 1
);