mysql_query question
| From: | John Biesnecker | Date: | Sat, 09 Dec 2000 02:57:48 +0000 |
| Subject: | mysql_query question | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-5120@lists.php.net to get a copy of this message | ||
Hello all.
I have two tables in a database, one of which ("accesslog") contains a
series of host names (i.e., ao.net) and another ("countrycodes") that
contains the ISO descriptions for various domain suffixes (i.e., an entry
".net" with a description "US Networks").
What I'm trying to do is get a count of the hits from various countries
determined by their suffix.
I'm trying to figure out of there is a way to do this via SQL. I've been
trying something like
SELECT hostname, COUNT(hostname) AS num, descrip FROM accesslog,
countrycodes WHERE RIGHT(hostname, 5) LIKE countrycodes.code GROUP BY
hostname ORDER BY num DESC;
but that doesn't work (comes up with an empty set). At this point I'm sort
of stuck.
Thanks for any help you can offer me!
/s/ John