0

Okay, so my database looks something like this:

MapID

h-1
h-2
s-1
s-2

What I'm trying to do is delete rows where the MapID begins with h, and not the rows that begin with anything else (I have multiple alphabet letters to distinguish which type of data is in that row). How would I go about doing that?

3 Answers 3

2
DELETE FROM map_table where mapid LIKE 'h%';

See documentation for LIKE.

Sign up to request clarification or add additional context in comments.

Comments

1

if you don't like using like you can use a string function like so

DELETE FROM table WHERE LEFT(MapID , 1) = "h";

this should be faster if you have an index on MapID

DEMO

Comments

0

You would just do:

delete t from table t
    where t.mapid like 'h%';

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.