SQL: If text contains "Mike", then...

J

J@Y

I have the script:

SELECT *
FROM MyTable
WHERE ID
Where Name = "Mike"

What do I put around "Mike" to make it so that anything that contains Mike
will do.
 
F

fredg

I have the script:

SELECT *
FROM MyTable
WHERE ID
Where Name = "Mike"

What do I put around "Mike" to make it so that anything that contains Mike
will do.

Well you have an inconsistency.

WHERE ID
Where Name = "Mike"

Where ID what?

If you are looking just for the [NameField], then

SELECT *
FROM MyTable
Where MyTable.NameField Like "*Mike*"

will find any record that contains Mike anywhere in the field.
 
J

J@Y

Yes thanks!
fredg said:
I have the script:

SELECT *
FROM MyTable
WHERE ID
Where Name = "Mike"

What do I put around "Mike" to make it so that anything that contains Mike
will do.

Well you have an inconsistency.

WHERE ID
Where Name = "Mike"

Where ID what?

If you are looking just for the [NameField], then

SELECT *
FROM MyTable
Where MyTable.NameField Like "*Mike*"

will find any record that contains Mike anywhere in the field.
 
Top