Table: combustsubmitters Domain bob.com fred.com hank.com Table: combust Domain | Clicks bob.com/somestring | 10 www.bob.com/?5=erf9uf | 8 fred.com/aefsadf | 14 bob.com/435df | 1 hank.com/plsdf | 90 I want to take these results and combine the hits based on the domain I can list them out obviously just fine I just can't figure out how to combine them Here's my code so far: $result = mysql_query("select * from combustsubmitters"); while($row = mysql_fetch_assoc($result)) { $resultb = mysql_query("select id,linkurl,clicks from combust where link = '1' && linkurl like '%$row[domain]%'"); while($rowb = mysql_fetch_assoc($resultb)) { $dateadd = date("j F Y", $rowb[dateadded]); echo '
| '.$rowb[id].', '.$rowb[linkurl].' | |
| Clicks: '.$rowb[clicks].' | |