I have a MySQL table that contains books information. Part of that information is a special character (^) separated list of values that corresponds to the book names. I'm having some problems getting the correct information out of the database. Table looks like
id OwnedBooks CustomerID
1 Harry^Two States^Tintin 101
2 Harry Potter^Tintin 290
3 Harry Prizoner of Azhaban 278
So when I search for 'Harry' in the ownedbooks column, I should get only one record i.e. (record id=1)
My query looks like below
SELECT * FROM books where ownedbooks like '%Harry%'
This query return all the records as I have used like, but I wanted to match the exact string with (^) as a separation.
When I search for 'Harry Potter' it should return the second record i.e (record id=2)