MySQL Left Join + Min

前端 未结 4 1281
闹比i
闹比i 2020-12-14 08:52

Seemingly simple MySQL question, but I\'ve never had to do this before..

I have two tables, items and prices, with a one-to-many relationship.

Items         


        
4条回答
  •  再見小時候
    2020-12-14 09:01

    SELECT top 1 items.id, items.name, prices.price, prices.id 
    FROM items  
    LEFT JOIN prices ON items.id = prices.item_id  
    ORDER BY prices.price ASC 
    

提交回复
热议问题