RE: Conditional INSERT INTO

2008-02-08 Thread Dave Watts
I want the user to add products into the order table but I don't want it to add the same product two or more times into the table. I made a condition and for a test I used ProductID s and I put them in the condition myself just to test it. If I enter the same productID which is in the

Conditional INSERT INTO

2008-02-08 Thread Ali
Hi: I want the user to add products into the order table but I don't want it to add the same product two or more times into the table. I made a condition and for a test I used ProductID s and I put them in the condition myself just to test it. If I enter the same productID which is in the table it

Re: Conditional INSERT INTO

2008-02-08 Thread Don L
A more efficient way would be (provided you're using enterprise-grade DBMS): cfquery datasource=test_shop if not exists (SELECT * FROM orders WHERE PRODUCTID = {cfqueryparam...}) begin INSERT INTO orders (productID) VALUES ({cfqueryparam...}) end