![]() |
|
|
Welcome to the { mindfrost82.com } forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Re: Get most used product code from SQL Server 2000 in SBS 2003
Try this:
SELECT ProdCode, COUNT(*) AS cnt FROM OrderDet GROUP BY ProdCode; To find the product code with most counts: SELECT TOP 1 WITH TIES ProdCode, COUNT(*) AS cnt FROM OrderDet GROUP BY ProdCode ORDER BY cnt DESC; -- Plamen Ratchev http://www.SQLStudio.com |
![]() |
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|