Good Morning.

Could someone tell me how you would go about doing a query to just get records that have an email account with(hotmail.com or msn.com or live.com)

I'm sure I could do it by selecting the entire DB and sorting them in PHP based on exploding the email field, but just wondered if there was a way to accomplish that in the query itself, so all that would return would be the records with those email account.

Thanks in advance for your feedback.

Douglas

If you have a field that holds the email you can include a LIKE clause in your query. E.g. to find all Hotmail address:

SELECT emailAddress FROM table WHERE emailAddresss LIKE '%hotmail%';

The % in the query indicate where hotmail should be in the string. By including % at the start and end you are saying that hotmail could appear anywhere in the email address. hotmail% would mean that hotmail is the start of the string.

If you have a field that holds the email you can include a LIKE clause in your query. E.g. to find all Hotmail address:

SELECT emailAddress FROM table WHERE emailAddresss LIKE '%hotmail%';

The % in the query indicate where hotmail should be in the string. By including % at the start and end you are saying that hotmail could appear anywhere in the email address. hotmail% would mean that hotmail is the start of the string.

Very Kewl...

Thank you very much. That is exactly what I was looking for.

I think I need to take a couple classes in mysql query development..

Thanks again
Douglas