Reputation: 105
I need to get data from database, that has a table called "our_videos", and a column called "champion" must contain a data with string that have character $. My current SQL code looks like this:
SELECT * FROM our_videos WHERE champion LIKE '%$%'
but it gives me data that looks like this: .....$.....$....$....$... but I only want a data that looks like this .....$..... Sorry if there are not enough needed data, just ask and I'll add if required.
Here as asked some sample data:
Table:
id|champion
54|"Something$Something"
55|"Something$Something$something"
56|"Something$Something$Something$something"
57|"Something"
With SQL command that I wrote I'd get rows with ID 54,55,56 but I want to get only row with id 54
Upvotes: 0
Views: 762
Reputation: 2899
Maybe should you indicate the number of occurrences of $ you're looking for... Like in this so answer.
Upvotes: 0
Reputation: 60462
You need a single $?
SELECT *
FROM our_videos
WHERE champion LIKE '%$%'
AND champion NOT LIKE '%$%$%'
Upvotes: 8