Results 1 to 2 of 2

Thread: Newbie help

  1. #1
    Join Date
    Oct 2002
    Location
    Houston, TX
    Posts
    34

    Unanswered: Newbie help

    OK, this is probably very basic, but to me it is all new.

    I have three tables...tbl_photos, tbl_customers, tbl_register

    I want to Insert INTO the cust_id field of tbl_register the cust_id field from tbl_customers where the email field from tbl_customers = str_email (from a form) and I also want to Insert into the photo_id field of tbl_register the photo_id field from tbl_photos where the code1 field from tbl_photos = str_code1 (from a form)


    What would be the correct syntax for this?

    I hope that description makes sence.

  2. #2
    Join Date
    Apr 2002
    Posts
    31
    You cant do this using single query. Use 2 steps:
    a. Get email from tbl_customers table. Since you are using values from user input in query, you have to preconstruct sql query, like:

    str='select cust_id
    from tbl_customers
    where email=' & value_from_field

    row=dbobject.execute (str)

    b. Insert value from step a into tbl_register

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •