Florin Serbanescu <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I have a string that contains a full path of a file
> for example. Also I have a table in Sqlite that
> contains a column name 'command' that has only the
> filename. My question is how I can create a query so I
> can retrieve all rows where command field is a
> substring of my string. In MySQL for example I can do
> this:
>
> SELECT * FROM mytable where 'c:\\Program Files\\a.exe'
> like concat('%',command,'%').
>
> But it seems that in Sqlite does not work. Would be
> something like:
>
> SELECT * FROM mytable where 'c:\\Program Files\\a.exe'
> like '%'||command||'%'.
>
SELECT * FROM mytable
WHERE 'c:\Program Files\a.exe' LIKE '%'||command||'%';
Note that backslash "\" should not be escaped in standard
SQL string literals. The need to double the \ characters
is a quirk of MySQL.
--
D. Richard Hipp <[EMAIL PROTECTED]>
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------