homepage Welcome to WebmasterWorld Guest from 54.167.10.244
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderator: open

Databases Forum

    
filtering queries based on number of matching results
Sgt_Kickaxe




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

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?

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved