Welcome to WebmasterWorld Guest from 54.166.224.46

Forum Moderators: open

Message Too Old, No Replies

filtering queries based on number of matching results

     
12:38 pm on May 4, 2010 (gmt 0)

WebmasterWorld Senior Member sgt_kickaxe is a WebmasterWorld Top Contributor of All Time 5+ Year Member



Lets say my database has some useful widget information in different tables as follows...

~ Widget title
~ Widget brand
~ Widget distributor

There are many brands which are in turn available from many distributors.

How would I print a list of brands that are available by at least TWO or more distributors?

$sql = "SELECT DISTINCT(distributor) FROM `".$config_databaseTablePrefix."widgets` ORDER BY distributor";

if (database_querySelect($sql,$rows))
{
foreach($rows as $product)
{
$item = array();

$item["name"] = $product["distributor"];


From there... how would I implement a check to see if a brand has at least 2 distributors?
 

Featured Threads

Hot Threads This Week

Hot Threads This Month