Re: [PHP-DB] most popular places

2005-03-15 Thread Kevin
Micah Stevens [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] With mysql 4.1 you could union and then subSelect maybe? I'm not super-familiar with sub selects, so this code won't likely run.. There is a unwritten rule that states: If your db needs the use of unions the db is set up

[PHP-DB] most popular places

2005-02-25 Thread Merlin
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

Re: [PHP-DB] most popular places

2005-02-25 Thread Joseph Crawford
the only way i can think of off the top of my head would not be intense as you would have to do a foreach for each of the cities such as $qry = select * from table $total = mysql_num_rows( $qry ); foreach( $cities as $city ) { // do db query such as // $qry = mysql_query(SELECT id FROM table

RE: [PHP-DB] most popular places

2005-02-25 Thread Bastien Koert
PROTECTED] 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

Re: [PHP-DB] most popular places

2005-02-25 Thread Martin Norland
Merlin wrote: 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

Re: [PHP-DB] most popular places

2005-02-25 Thread Micah Stevens
With mysql 4.1 you could union and then subSelect maybe? I'm not super-familiar with sub selects, so this code won't likely run.. But then, you're runn 4.0x so it won't run anyway. :) select city_id, count(city_id) as num from ((select city_id from members) UNION (select city_id from