Reputation: 161
I have a MySQL table, and for this purpose say the database name is 'A_blah', that has several columns but i am interested in removing rows based on a specific column containing a string with a certain character. An example would be say there is a column containing:
A
A{
B
B{
AA
AA{
What i am looking to do is to remove each row that has '{' in the string in this column leaving:
A
B
AA
Is this possible with a query and if so could you show and explain? Thank you so much.
Upvotes: 1
Views: 384
Reputation: 58281
You can also use MySQL Regular Expression
DELETE FROM A_blah WHERE column_name REGEXP '[A-Z]*[{][A-Z]*'
Upvotes: 1
Reputation: 80623
Assuming that's the only character your dealing with a simple:
DELETE FROM A_Blah WHERE col LIKE '%{%';
Should suffice.
Upvotes: 3