Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT m.Manufacturer,m.Model,COUNT(o.VehicleId) AS 'TimesOrdered'
- FROM Models AS m
- LEFT JOIN Vehicles AS v ON v.ModelId=m.Id
- FULL JOIN Orders AS o ON v.Id=o.VehicleId
- GROUP BY m.Manufacturer,m.Model
- ORDER BY TimesOrdered DESC,m.Manufacturer DESC,m.Model ASC
Advertisement
Add Comment
Please, Sign In to add comment