Re: Creating temp table with data out of 2 tables possible?
| From: | Jarosław Jankowski | Date: | Sat, 09 Feb 2002 12:13:35 +0000 |
| Subject: | Re: Creating temp table with data out of 2 tables possible? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-16751@lists.php.net to get a copy of this message | ||
Andy wrote:
> Hi there,
>
> how is it possible to copy rows from more then one table into a temporary
> table?
>
> I have 250 city tables named after the country e.g: ca_cities. Now the user
> has choosen stuff from
> lets say ca and gm. I want to collect the data into a temp table and then
> querry this temp table for other stuff.
>
> I always get the error:
> Error: 1060 Duplicate column name 'id'
>
> Here is my statement made for a sample of two tables creating the temporary
> one ( works with one)
>
> $stmt ="
> CREATE TEMPORARY TABLE all_cities
> SELECT * FROM $DB2.$country_found[0]_cities,
> $DB2.$country_found[1]_cities
> ";
>
> Does anybody have a clue whats going on here?
>
> Thanx for any help
>
> Andy
try to use coulumn names not * and rename columns
Jarek