Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT T2.Beername, T2.Brewername, T2.Beerprice
- FROM (
- SELECT Brewers.Name AS BrewerName, MAX(Price) AS MaxPrice
- FROM Beers INNER JOIN Brewers ON Beers.BrewerId = Brewers.Id
- GROUP BY Brewers.Id
- ) AS T1
- INNER JOIN (
- SELECT Brewers.Name AS BrewerName, Beers.Name AS Beername, Beers.Price AS BeerPrice
- FROM Brewers INNER JOIN Beers ON Brewers.Id = Beers.BrewerId
- ) AS T2
- ON T1.MaxPrice = T2.BeerPrice AND T1.BrewerName = T2.BrewerName
- ORDER BY T2.BrewerName, T2.Beername;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement