开发者

Query in SQL to show average price for cars of same brand

How do I type in query in 开发者_JS百科table "cars" to give me 2 brands I want(there are many cars with same brand) and average prices of all the cars of that brand. http://i.stack.imgur.com/k7fmn.jpg


SELECT brand, avg(price)
    FROM cars
    WHERE brand IN ('SAAB', 'Volvo')
    GROUP BY brand


Without more info, something like this should work:

select brand, avg(price)
from cars
where brand in ('brand1', 'brand2')
group by brand
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜