1

i have a table i which there r 3 columns comp_no comp_area comp_post_code

now comp_area should have area of that place like , Toronto Vancouver, Winnipeg ...

But near about 2,290 entries r wrong and have comp_no in it like 17310 111 Ave NW, 205 Main St and so on. i want to remove these 2,290 entries and replace them with 0

I am using this to find these column

SELECT * 
FROM  `canada_database` 
WHERE comp_area !=  ''
AND comp_area NOT REGEXP  '^[[:alpha:]]'
ORDER BY slno ASC 
LIMIT 0 , 30

can it be done with mysql query

2 Answers 2

1
UPDATE `canada_database` 
SET comp_area =  '0'
WHERE comp_area !=  ''
AND comp_area NOT REGEXP  '^[[:alpha:]]'
Sign up to request clarification or add additional context in comments.

Comments

1

Try this query

UPDATE `canada_database` 
SET comp_area = 0
WHERE id IN (
    SELECT GROUP_CONCAT(id)
    FROM  `canada_database` 
    WHERE comp_area !=  ''
    AND comp_area NOT REGEXP  '^[[:alpha:]]'
)

Comments

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.