Jump to content

Archived

This topic is now archived and is closed to further replies.

Face

Include and Exclude

Recommended Posts

Hi,

 

I've got a column (serialcat) in table (serial) which contains a combination of characters - axzyodu.

 

These characters could be in any order for each row. What I want to do is to display all rows that contain 'o' or 'd' but not 'y' in the serialcat column.

 

So I'd expect back examples of :

axdo

xuod

zoda

oax

xdu

etc.....

 

Any help appreciated.

 

Thanks.

Share this post


Link to post
Share on other sites

You can use regular expressions to accomplish your task:

 

SELECT serialcat FROM serial WHERE serialcat REGEXP '[od]' AND serialcat NOT REGEXP 'y'

 

Hope that helps.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.