lundi 11 janvier 2016

sqlite select syntax where question mark IS the criteria

I have a SQLite table where some of the rows have fields which contain punctuation. I am having trouble preparing a SELECT statement that lets me locate all the rows that contain one or more question mark characters.

I use the ESCAPE clause to retrieve objects with embedded percent signs (I use the guillemet '»' for my escape character). This query finds all rows containing the literal string '%F5':

SELECT m.PKey 
FROM EE_Messages m 
WHERE m.Message LIKE '%»%F5%' ESCAPE '»'; 

Unfortunately, when I try a similar approach with the question mark, I get no match (the literal string is 'available?').

SELECT m.PKey
FROM EE_Messages m
WHERE m.Message LIKE '%available»?%' ESCAPE '»'; 

I know this question has come up before, but I have so far been unable to locate an answer.

Aucun commentaire:

Enregistrer un commentaire