Good day coders,
I need to make a query where I find a manufacturer.name (For example: "Logistics") only when the name is contained inside a string (For instance: "Logistics spa").
How can I do this?
This is my manufacturer table model:
| id | name |
|---|---|
| 0 | Logistics |
| 1 | TE CONNECTIVITY |
My database Engine is ISAM, and I’m using MariaDB as the main database.
For instance, I need to find the manufacturer.name contained in the string "CGS – TE CONNECTIVITY".
I tried this:
SELECT m.name FROM manufacturers as m WHERE m.name in ("CGS - TE CONNECTIVITY");
but of course, this won’t work the way it should.
My expected result should be in this case:
| name |
|---|
| TE CONNECTIVITY |
>Solution :
SELECT *
FROM manufacturer
WHERE ‘Logistics spa’ LIKE CONCAT(‘%’, name, ‘%’);