Hi. I know that this isn't strictly PHP, but this is the only place I know to ask - so apologies in advance. I am trying to make this query work but I am having very little luck: SELECT links.id, COUNT(clicks.id) AS tot_clicks FROM links INNER JOIN clicks ON links.id = clicks.linkid GROUP BY links.id; I want to output the links which have had the most clicks. However, I store the links in one table, and each individual click is stored in another table. Each click has a linkid that identifies the id of the link that was clicked on. I know this sounds confusing, but I would appreciate any help you can give. Thank you Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]