|
Subject:
|
Count the same items
|
|
Posted By:
|
stasnikov
|
Post Date:
|
1/12/2007 8:16:54 AM
|
Hi, does some one knows how to show the most used items items from a table?? like:
yellow green blue yellow yellow green
the thing i have to see is the most used color. In this case it is yellow.
Please help me.
|
|
Reply By:
|
mmcdonal
|
Reply Date:
|
1/12/2007 11:23:45 AM
|
SELECT TOP 1 tblYourTableName.Color, Count(tblYourTableName.Color) AS CountOfColor FROM tblYourTableName GROUP BY tblYourTableName.Color;
In your case, this will return
Color CountOfColor yellow 3
HTH
mmcdonal
|
|
Reply By:
|
stasnikov
|
Reply Date:
|
1/15/2007 5:20:27 AM
|
Thanks it works!!!
|