for more info please look at the previous thread to show the process of working the first query out and the thinking behind it
http://www.tek-tips.com/viewthread.cfm?qid=1349682&page=1
Many thanks
I am getting errors with a MySQL insert query which is puzzling me, it is based on the following query that works perfect.
INSERT INTO selected_product_parent_options (F_ID, NAME) (SELECT {GET.NxT_ID}, NAME FROM parent_options WHERE NAME NOT IN (SELECT NAME FROM selected_product_parent_options)...
I have been playing with various scripts to make a horizontal text scroller with the contents taken from an external file (php). This is not a problem but i need to be able to add two buttons that allow the direction to change ( < || > )and to pause on mouse over. This would normally be straight...
well good news is no error but this time it will only insert if there is no other name match in the table, it need to be a combination of the both, if the F_ID match and the NAME matches on the same record.
the F_id come from the $_GET and the NAME which is not in another table.
got this error, and yes F_ID is a numeric field
SQL error: 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 2 NOT IN (SELECT F_ID FROM selected_product_parent_options.
no didnt work got this error
Error:
SQL error: 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 '2' NOT IN (SELECT F_ID FROM selected_product_parent_optio.
I feel so close to it!
tried this
INSERT INTO selected_product_parent_options (F_ID, NAME) (SELECT '{GET.NxT_ID}', NAME FROM parent_options WHERE NAME NOT IN (SELECT NAME FROM selected_product_parent_options WHERE '{GET.NxT_ID}' NOT IN (SELECT F_ID FROM selected_product_parent_options)))
but I still get duplicate...
No it did work :( i got this
Error:
SQL error: 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 F_ID NOT IN (SELECT F_ID FROM selected_product_parent_opti.
what i was trying to do was check if both the...
This what I tried to get around it
INSERT INTO selected_product_parent_options (F_ID, NAME) SELECT '{GET.NxT_ID}', NAME FROM parent_options WHERE NAME NOT IN (SELECT NAME FROM selected_product_parent_options WHERE F_ID selected_product_parent_options != '{GET.NxT_ID}')
Is all coding like this, fix one problem and another one pops up!
I did the code but I get a duplication of the F_ID which is taken form the url query string, I though by adding the AND if would make sure that both conditions together would make the insert, but as I have removed the AND the...
I relised I need to extentd the above to get it to work the way I need for my site, I tried this based on the above( which worked great thanks!)
INSERT INTO selected_product_parent_options (F_ID, NAME) (SELECT '{GET.NxT_ID}', NAME FROM parent_options WHERE NAME NOT IN (SELECT NAME FROM...
Update
If I try this I get no error but the second value put the select statement in as a text string not the result of the query
INSERT INTO selected_product_parent_options (F_ID, NAME) VALUES ('2', 'SELECT NAME from parent_options WHERE NAME NOT IN (SELECT NAME from...
Hi All
This is my first posting so I hope I am in the correct area! The following code works perfect
INSERT INTO selected_product_parent_options (NAME) SELECT NAME from parent_options WHERE NAME NOT IN (SELECT NAME from selected_product_parent_options)
how ever if I try this
INSERT INTO...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.