Guest User

Untitled

a guest
Feb 20th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. Select TOP 3 Categories.id, Categories.Description, avg(Products.Price) as MeanPrice, count(Products.IsAvailable) as NumberOfAvailableProducts
  2. FROM Categories
  3. INNER JOIN ProductCategories on Categories.Id =
  4. ProductCategories.CategoryId
  5. INNER JOIN Products on Products.Id = ProductCategories.CategoryId
  6. WHERE Products.IsAvailable='true'
  7. GROUP BY Categories.Id, Categories.Description
  8. ORDER BY MeanPrice DESC
Add Comment
Please, Sign In to add comment