Top100

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Jerry, Thanks for that. It worked just like I wanted...

My next problem I have found is when I delete the Qty as found thats not
what I was after. I am wanting to count the number of products instead.

I tried to replace the Qty with just the Products and this doesnt give me a
count of all the same product, just gives me a count of 1 each time.

How can I measure the Top100 products

Jez
 
Is this what you are looking for?
SELECT TOP 100 YourTableName.EngineerID, YourTableName.Contract,
Count(YourTableName.products) AS [Quanity of Products]
FROM YourTableName
GROUP BY YourTableName.EngineerID, YourTableName.Contract
ORDER BY YourTableName.EngineerID, Count(YourTableName.products) DESC;


Jez said:
Jerry, Thanks for that. It worked just like I wanted...

My next problem I have found is when I delete the Qty as found thats not
what I was after. I am wanting to count the number of products instead.

I tried to replace the Qty with just the Products and this doesnt give me a
count of all the same product, just gives me a count of 1 each time.

How can I measure the Top100 products

Jez

Jerry Whittle said:
See if this will work. You'll need to put in the proper table name twice.

SELECT T1.EngineerID,
T1.Contract,
T1.products,
T1.qty
FROM YourTableName AS T1
WHERE T1.[qty] In
(SELECT TOP 100 T2.[qty]
FROM YourTableName AS T2
WHERE T2.[qty] = T1.[qty]
AND T2.[products] = T1.[products]
ORDER BY T2.[qty] DESC);
 
Back
Top