0

Hello,

I have two tables one for the customer_records and one for the jobs. Both tables are linked together(both contains customerID and foreign key is set)

I am trying to insert data into the job table by obtaining the customer ID that is given in the textbox.

I have:

    INSERT INTO jobs (priority, date, deadline, material, status) VALUES (?, ?,?,?,? ) select customerID from Customer where CustomerID =?"

But still get an error.

Can you guys give me a hint, that will be appreciated.

Regards.

PS: I am using java and mysql if this can help.

3
Contributors
3
Replies
5
Views
5 Years
Discussion Span
Last Post by smantscheff
0

Try this version. It looks like you have got your WHERE condition syntax incorrect

INSERT INTO jobs (priority, date, deadline, material, status) VALUES (?, ?,?,?,? ) WHERE customerID = (SELECT customerID from Customer where CustomerID =?)

0

I changed it and got:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE customerID = (SELECT customerID from Customer where CustomerID ='3')'

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.