We help IT Professionals succeed at work.
Get Started

Update Set Column Query Not Working as Expected

Ridgejp asked
Last Modified: 2017-04-27

I have a table (holding_amazon) which contains orders from Amazon. I want to check that the "catID", the product SKU of the item, that was assigned to it when it was listed has no errors in the formatting by checking it's exists in another table (productCode) - this contains a list of approved SKU's.

I've written the following query which I thought would check that the SKU exists in the table "productCode" under the column "itemTitle" and if it is that it doesn't to set the value of "catID" to empty so that an exception report can pick it up later in the process.

update productCode, holding_amazon set holding_amazon.catID ='' where holding_amazon.catID <> productCode.itemTitle

Open in new window

When I test the above query it sets all the values for "catID" to empty even though 90% exist in "productCode" table ... what am I doing wrong?
Watch Question
Most Valuable Expert 2017
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE