Hi Fraser,

I a sorry I dont understand what you want to do. Could you show how you want 
it to be and the queries which you used so far ?

Best regards

Nils Valentin
Tokyo/Japan


2003年 8月 13日 水曜日 08:30、Fraser Hanson さんは書きました:
> I have table A with column id, and table B with columns id and
> content.
>
> I am trying to build a query that inserts all ids from table A into
> table B, and also sets the "value" field for all these new entries to
> a given value.
>
>
> For example:
> #Before the query, the tables are like this:
> mysql> select * from a;
>     +------+
>
>     | id   |
>
>     +------+
>
>     | hal  |
>     | ron  |
>     | kip  |
>     | dag  |
>     | bob  |
>     | max  |
>
>     +------+
>
> mysql> select * from b;
>     +------+-------+
>
>     | id   | value |
>
>     +------+-------+
>
>     | bob  |  4    |
>     | bob  |  5    |
>     | max  |  5    |
>
>     +------+-------+
>
> # After the query,  b is like this:
>
> mysql> select * from b;
>     +------+-------+
>
>     | id   | value |
>
>     +------+-------+
>
>     | bob  |  4    |
>     | bob  |  5    |
>     | dag  |  4    |
>     | hal  |  4    |
>     | kip  |  4    |
>     | max  |  4    |
>     | max  |  5    |
>     | ron  |  4    |
>
>     +------+-------+
>
> I have been trying variations on the INSERT ... SELECT syntax, but
> I suspect this is a dead end.  The next best thing I can think
> of is building a temporary table that has the values that I want, and
> then using INSERT ... SELECT to copy them all into table b.
>
> Can anyone suggest a way to achieve this?
> --Fraser Hanson

-- 
---
Valentin Nils
Internet Technology

 E-Mail: [EMAIL PROTECTED]
 URL: http://www.knowd.co.jp
 Personal URL: http://www.knowd.co.jp/staff/nils


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to