Search code examples
sqlpervasivepervasive-sql

SQL statement with LIKE


I would like to select all records that have an underscore character in their 11th character, so i try this:

SELECT * FROM "BOM_SUB_LEVEL" where TOP_CODE like '%%%%%%%%%%_%%%'

but this doesnt work as expected, can someone help?


Solution

  • Just use the "SUBSTRING" function :

    SELECT * FROM "BOM_SUB_LEVEL" where SUBSTRING(TOP_CODE, 11, 1) = "_"
    

    Marc