I have a MySQL table called 'Employee'. It has seven columns, but only two column values are related to my question. The two column names are FullName and Name.
Here are some sample values of the two columns in the table for better understanding.
FullName Name
----------
MichealPhilips | Philips
Louisfarak | louis
Waynebruce | kirten
I want to find the rows where FullName value contains the value of name. So in my example the answer should be MichealPhilips and Louisfarak but not Wayne bruce because FullName(Waynebruce) does not contain Name(Kirten).
I have tried a query some thing like this:
SELECT * FROM Employee WHERE FullName LIKE '%' || Name || '%';
But it seems like a wrong query. It is printing all the rows in the table and I don't know why.
Can someone please help me in this? Are there any other ways to write this query? Is my query wrong?