Link to home
Create AccountLog in
Avatar of mharcais
mharcais

asked on

Search for a particular string

Hi,
My table is called Emails and the email field is called Email.
I want to run a query for all email addresses with a particular extension. Here's what I have (but it's not working), please assist:

SELECT Email
FROM Emails
WHERE (((Emails.Email)="%.pl%"));

When that didn't work, I tried this one:

SELECT Email
FROM Emails
WHERE (((Emails.Email)="#.pl#"));

Neither bring me back any results, though there are plenty of records matching this criteria....
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Use LIKE:

SELECT Email
FROM Emails
WHERE (((Emails.Email) LIKE "%.pl%"));
Use like instead of =
try

SELECT Email
FROM Emails
WHERE ((Emails.Email) LIKE '%.pl%');
SELECT Email
FROM Emails
WHERE (((Emails.Email) like "%.pl%"));
at least I was not the last person :)
Avatar of mharcais
mharcais

ASKER

HI!
Blank.... draws nothing back.

I'm pulling my hair out here! IF I do a search for .pl as a part of the field in the table, I get tons, but within the query... NOTHING!
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
By the way, this query is for an Access 2003 database...
SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Are you sure its .pl and not .PL? Ignore case and see if u get anything.
glad I could help, but I think at least a point split with mbizup who posted the same just above would have been fair?!
Sorry, mbizup, I missed that, apologies.

Is there a way to split the points now?
Thanks, mharcais and a3!