0

How can I simply filter a table row by alphabets for example showing only rows with strings starting with e,f and g and exclude other rows.

Something like

return (rows > "d") andalso (rows < "h")

in vb.net

2 Answers 2

1

you can use like if you want regular expression. for example, this will give you all rows starting with a:

select * from myTable where myColumn like 'a%';

EDIT:

I see what you mean now, mysql supports > and < for strings as well, so if you do:

where col >= 'e' and col < 'h'

you will essentially get everything starting by e,f,g

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

3 Comments

and what about b c d... I want something to compare like < or > in vb.net for example all rows < h and rows > d
@idealidea - see my edit, I think I understand your question better now
Oh now I see, but I was thinking of using like someway I didn't know its possible simply by operators >= and <, and as I remember only like was strings comparing solution in mysql. Thanks anyway. This works.
1

You can combine multiple LIKE operator saying

select * from table1
where mycol like 'e%'
or mycol like 'f%'
or mycol like 'g%';

(OR) you can use LEFT() string function saying

select * from table1
where left(mycol,1) in ('e','f','g');

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.