Re: [PHP] SQL: INSERT using subqueries

2002-12-16 Thread Evan Nemerson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Ohhh you're close. A little tweak, and it works. Here's what I came up with: INSERT INTO myTable (owner, name) SELECT id as "owner", 'myName' as "name" FROM users where username='myUserName'; I think if you omit the (owner, name), it thinks

Re: [PHP] SQL: INSERT using subqueries

2002-12-16 Thread Ernest E Vogelsinger
At 09:01 16.12.2002, Evan Nemerson said: [snip] >Anyways, my question is rather simple- how do I do an INSERT using a >subquery? >I want something like this- only one that works: > >INSERT INTO myTable >SET owner=(SELECT id FROM users WHERE username='myUsern

[PHP] SQL: INSERT using subqueries

2002-12-16 Thread Evan Nemerson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 First off, sorry it's a SQL question not PHP, but I don't subscribe to mysql-general (or whatever it's called), and I have a feeling someone on this list will be able to help... Anyways, my question is rather simple- how do I do an INSERT using a su