DB Problem
| From: | Adam Charnock | Date: | Sun, 08 Apr 2001 08:15:52 +0000 |
| Subject: | DB Problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-47637@lists.php.net to get a copy of this message | ||
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