我有2个表,产品有主键和名称,价格有pk,fk(pk of product)
和价格。现在我必须select * from price
,但需要显示产品名称而不是fk。我怎么能这样做?
答案 0 :(得分:3)
SELECT pd.name, pc.price
FROM product AS pd
INNER JOIN price AS pc
ON pd.id = pc.productid
答案 1 :(得分:2)
Select p.*, pr.Name from price as p
join product as pr on p.productid = pr.Id