RE: [PHP-DB] most popular places
| From: | Bastien Koert | Date: | Fri, 25 Feb 2005 19:43:39 +0000 |
| Subject: | RE: [PHP-DB] most popular places | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-38674@lists.php.net to get a copy of this message | ||
Use a join to get the city name
Use grouping to group the most common cities
select a.*, b.* from table1 a inner join table2 b on a.id = b.id [where clause]
group by a.id
Would need a little more data about the structure of the tables to give a more complete answer
bastien
From: Merlin <news.groups@web.de> To: php-db@lists.php.net Subject: [PHP-DB] most popular places Date: Fri, 25 Feb 2005 16:08:54 +0100 Hi there, I am trying to do a tricky task with PHP and MySQl 4.0.x There are 3 content tables where each of them contains a city_id and there is a 4th table which holds the city_id and the acording city_name Now I would like to find out the most used city names. For example: members pictures reports 3 4 3 2 9 8 9 8 8 So the most used city_ids are 8 3 9 To find this out would be a chelenging task, but to merge them with the city name is even more difficult I am working on this quite a while now and cant find a way. Maybe someone of you guys could give me a smart push. Thank you for any help, Merlin -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php