If I have a table sales:
sales {sellerid, buyerid}
I'm trying to determine the buyers favourite seller... So I need to return the most frequent sellerid.
I've used this query to find out the total number of times the buyer has bought something from any seller:
$countseller = mysql_query("SELECT count(sellerid) FROM sales WHERE buyerid = '$buid'");
$cnt = mysql_fetch_array($countseller);
echo "Number of times = '{$cnt[0]}'";
This returns '7' sales. So out of these 7, how can I determine which seller is the favourite?