I have a database in which I need to search based on the keywords, regardless of the order. See the full table below:
+----+-----------------------+
| id | description |
+----+-----------------------+
| 1 | joão de santo cristo |
| 2 | eduardo e mô nica |
| 3 | santo cristo joão |
| 4 | cristo santo joão |
| 5 | juazeiro do norte |
+----+-----------------------+
When I search with a using LIKE "%joão%cristo%"
the result is:
+----+-----------------------+
| id | description |
+----+-----------------------+
| 1 | joão de santo cristo |
+----+-----------------------+
The query searches only the result according to the order of the words, first joão
tracking anything and second cristo
. I would like the return to be this way below independent of the word order. See:
+----+-----------------------+
| id | description |
+----+-----------------------+
| 1 | joão de santo cristo |
| 2 | santo cristo joão |
| 3 | cristo santo joão |
+----+-----------------------+
What would the query look like in order to search the database independently of the word order?