Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created June 14, 2019 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/870dbf5679d2adaee439c435ad7b749a to your computer and use it in GitHub Desktop.
Save parzibyte/870dbf5679d2adaee439c435ad7b749a to your computer and use it in GitHub Desktop.
/*Listado de productos por no de ventas ordenando de mayor a menor*/
select pp.ProductID, pp.Name,pp.ProductNumber, pp.ListPrice,
count(ss.ProductID) as veces_vendido
from Production.Product pp
inner join Sales.SalesOrderDetail ss
on pp.ProductID = ss.ProductID
group by ss.ProductID, pp.Name, pp.ProductID,pp.ProductNumber, pp.ListPrice
order by count(ss.ProductID) desc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment