0

Due to an older version of MySQL I'm having to use some pretty outdated methods to get things done. At the moment I am trying to copy similar rows to another table based on a few distinct columns. The table holddups will be taking data from assets where the SKU and Description match those of one in holdkey. The command I'm running is:

INSERT INTO holddups
SELECT * 
FROM assets, holdkey
WHERE assets.SKU = holdkey.SKU
AND assets.Description = holdkey.Description

And the error I'm getting is:

#1136 - Column count doesn't match value count at row 1

I hope this is enough to sort this all out, but if not feel free to ask more.

1 Answer 1

1

Selecting just * will take all columns from assets and holdkey and try to put it in holdups. But holdups does not have that much columns. Using assets.*will only take all columns of assets and that is what you want, right?

INSERT INTO holddups
SELECT assets.* 
FROM assets, holdkey
WHERE assets.SKU = holdkey.SKU
AND assets.Description = holdkey.Description
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.