On Mon, Mar 19, 2001 at 12:51:27PM +0100, - = k o l i s k o = - wrote:
> Hi!
> 
> i try one little question.
> 
> when the table2 have one more row then table1.. is possible try something
> like this:
> 
> insert into table2 ($date, select * from table1 where username = '$uname')

One more 'column' you mean, not 'row'.  Yes, this is possible, though
a bit more difficult - you cannot use '*' in the select statement, rather
something like this..

If table1 has 3 columns - name, birthdate, salary - then you can do:

INSERT INTO table2 SELECT '$date', name, birthdate, salary FROM table1
        WHERE username='$uname';

You can actually place any constant value in a SELECT statement - that's
the idea behind the above insert-from-select.

G'luck,
Peter

-- 
If this sentence were in Chinese, it would say something else.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to