-----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 subquery? 
I want something like this- only one that works:

INSERT INTO myTable
SET owner=(SELECT id FROM users WHERE username='myUsername');

Actually, I want to set a few more fields too, but not using subqueries. I 
would prefer the ..() VALUES ()... syntax, but I converted to this when I 
suspected that was the problem- it wasn't.

I realize that I _could_ get put the id into a PHP variable, then make another 
query from that (which is what I'll be doing until i get a response ;)), but 
I'd prefer not to.

Any help would be much appreciated, and thanks in advance!


- -Evan



- -- 
To achieve adjustment and sanity and the conditions that follow from them, we 
must study the structural characteristics of this world first and, then only, 
build languages of similar structure, instead of habitually ascribing to the 
world the primitive structure of our language.

- -Alfred Korzybski
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9/YiD/rncFku1MdIRAg13AJ0VWveL8D79oMGuD+LVXpliqecbYgCeKlBw
S+j22cnoMS/WNm0Iwbxjzlo=
=EC92
-----END PGP SIGNATURE-----


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to