0

I have a script that is generating queries like this one by grabbing categories and keywords from the database. However something is wrong with the syntax it seems. here is the code first:

UPDATE `mrhowtos_main`.`eng-jap` SET `category` = 'travel' WHERE `eng` REGEXP 'abroad|country|sight seeing|foreign|plane|train|bus' and where `category` REGEXP 'misc|none';

and here is the error returned by mySQL:

1064 - 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 category REGEXP 'misc|none'' at line 1

I have looked at it for a long time and still dont seem to see what is wrong with it. im certain the error is not in the table or column names in the DB.

1 Answer 1

2

The second where shouldn't be there. Try:

UPDATE `mrhowtos_main`.`eng-jap` SET `category` = 'travel' WHERE `eng` REGEXP 'abroad|country|sight seeing|foreign|plane|train|bus' and `category` REGEXP 'misc|none';
Sign up to request clarification or add additional context in comments.

2 Comments

bingo! but the funny thing is, im sure i tried that already, but maybe that was when something else was wrong with it, any way. thanks.
@user1397417 Please remember to accept this answer when you have a chance, thanks!

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.