Adrian,

You may try this:

INSERT INTO tbl_temp2 (fld_id)
    SELECT tbl_temp1.fld_order_id
    FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;

Best Regards,
Jonathan Chiu
OOCL Logistics
Unit 1, 4/F., Sun Hung Kai Centre, 30 Harbour Road, Wanchai
TEL: 852 . 2990 0174
FAX: 852 . 28249017

-----Original Message-----
From: adrian Greeman [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 21, 2004 1:12 AM
To: [EMAIL PROTECTED]
Subject: simple question on WHERE SELECT query 

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.


Regards

                                       Adrian


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



IMPORTANT NOTICE
Email from OOCL is confidential and may be legally privileged.  If it is not intended 
for you, please delete it immediately unread.  The internet cannot guarantee that this 
communication is free of viruses, interception or interference and anyone who 
communicates with us by email is taken to accept the risks in so doing.  Without 
limitation, OOCL and its affiliates accept no liability whatsoever and howsoever 
arising in connection with the use of this email.  Under no circumstances shall this 
email constitute a binding agreement to carry or for provision of carriage services by 
OOCL, which is subject to the availability of carrier's equipment and vessels and the 
terms and conditions of OOCL's standard bill of lading which is also available at 
http://www.oocl.com.

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

Reply via email to