I am trying to do a search query that finds a single manufacturer that shows up the most in the search results. I have been able to get the search to tell me each manufacturer and the number of times it shows up, but I need to be able to select the manufacturer with the most duplicates. <br>
<br>
I have attached my code.<br>
<br>
SELECT DISTINCTROW First(Products.Manufacturer) AS [Manufacturer1],<br>
Count(Products.Manufacturer) AS Amount1<br>
FROM Products<br>
WHERE Search_Key LIKE '#PN4#%'<br>
GROUP BY Products.Manufacturer<br>
<br>
The Results look like:<br>
<br>
ABC - 5<br>
DEF - 12<br>
GHI - 2<br>
<br>
I want to be able to automatically select DEF since it has the most duplicates. I know that I need to perform a sub-query on the first query to find the max of Amount1, but I can't see to get it to work.<br>
<br>
Any help is greatly appreciated.<br>
<br>
Thanks,<br>
Tom Komin
<br>
I have attached my code.<br>
<br>
SELECT DISTINCTROW First(Products.Manufacturer) AS [Manufacturer1],<br>
Count(Products.Manufacturer) AS Amount1<br>
FROM Products<br>
WHERE Search_Key LIKE '#PN4#%'<br>
GROUP BY Products.Manufacturer<br>
<br>
The Results look like:<br>
<br>
ABC - 5<br>
DEF - 12<br>
GHI - 2<br>
<br>
I want to be able to automatically select DEF since it has the most duplicates. I know that I need to perform a sub-query on the first query to find the max of Amount1, but I can't see to get it to work.<br>
<br>
Any help is greatly appreciated.<br>
<br>
Thanks,<br>
Tom Komin