0

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

Donny123
  • 105
  • 6

2 Answers2

8

You need a single $?

SELECT * 
FROM our_videos 
WHERE champion LIKE '%$%'
  AND champion NOT LIKE '%$%$%'
dnoeth
  • 59,503
  • 4
  • 39
  • 56
0

Maybe should you indicate the number of occurrences of $ you're looking for... Like in this so answer.

Community
  • 1
  • 1
JBA
  • 2,889
  • 1
  • 21
  • 38