one, two or more search
Posted: Thu Jan 25, 2007 3:37 am
Hi,
In MYSQL how can I do a search on one or more words searching multiple fields?
For example, if I searched "ST JOHN" and we had a field in the database named "mytxt", which was datatype "TEXT" with the following text
1. "Today it was reported st john road has been closed"
2. "Joe walked across the road"
I want to search the left of the word "ST" and "JOHN". Only record 1. should be found. Record 2 containing "JOE" matching "JOHN" should not appear
How can I do this?
the above would give me both records. How can I just get record 1 because it matched "ST" and "JOHN".
I should be able to search for "JOHN" and get record 1 only or search for "JOE" and get record 2 only.
In MYSQL how can I do a search on one or more words searching multiple fields?
For example, if I searched "ST JOHN" and we had a field in the database named "mytxt", which was datatype "TEXT" with the following text
1. "Today it was reported st john road has been closed"
2. "Joe walked across the road"
I want to search the left of the word "ST" and "JOHN". Only record 1. should be found. Record 2 containing "JOE" matching "JOHN" should not appear
How can I do this?
Code: Select all
select * from table1 where mytxt like '%ST JOHN%'I should be able to search for "JOHN" and get record 1 only or search for "JOE" and get record 2 only.