Howdy, group! Well, I sure felt like I was on the right track with this one, but just can't get around the last curve. Hopefully I can explain it well enough that somebody could help navigate...
What I'm trying to do is display a list of division names assuming that each division has at least 2 teams associated with it. Let's start with the table definitions: table name #1: division | ID | leagueID | name | rank | | 1 | 1 | Gold | 1 | | 2 | 1 | Silver | 2 | | 3 | 1 | Bronze | 3 | | 4 | 2 | Level 1 | 1 | table name #2: team | ID | leagueID | divisionID | name | | 1 | 1 | 1 | Vipers | | 2 | 1 | 1 | Warthogs | | 3 | 1 | 1 | Kings | | 4 | 1 | 2 | Ducks | I created the following query: SELECT division.ID as curID, division.name, SUM( IF(team.divisionID = 'curID', 1, 0)) as teamcount FROM division, team WHERE division.leagueID = '1' GROUP BY division.ID having teamcount > 1 This results in zero records. During some testing I found that, instead of trying to sum based on the "IF(team.divisionID = 'curID'", and instead used an actual value, like this: "IF(team.divisionID = '1'", that would produce results, but it would list every division name and the team count would be "3" in each row. I hope that was descriptive enough... Thanks in advance for your help! John __________________________________________________ Do You Yahoo!? Try FREE Yahoo! Mail - the world's greatest free email! http://mail.yahoo.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php