"adrian Greeman" <[EMAIL PROTECTED]> wrote:
> There is a particular form of SQL query you can use I believe when you
> are adding data to a table and want to include an ID number from another
> lookup table but you only know the name reference and not the ID
>
> eg it might be an "author" table with an author_id and author_name and
> you want to enter a row into a book table which uses author_id but you
> only know the name.
>
> I think the statement involves a WHERE followed by a SELECT but am
> unsure of the precise syntax.
Seems you need INSERT .. SELECT:
INSERT INTO book( .. ) SELECT author_id .. FROM author WHERE
author_name="name";
--
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Egor Egorov
/ /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED]
/_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net
<___/ www.mysql.com
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]