Search code examples
hive

Hive SQL escape special char


I am new to Hive SQL. I want to query some data which contains this part:

aid\":\"abcd

I have tried this:

data like '%aid\\\\":\\\\"abcd%'

but it does not work. Thank you!


Solution

  • Would you try this ?

    WITH data AS (
      SELECT 'aid\\":\\"abcd' str
    )
    SELECT str FROM data WHERE str LIKE '%aid\\":\\"abcd%';
    

    Query results

    enter image description here