On 2015-09-04 06:09 PM, Peter Haworth wrote:
> Thanks for the info.
>
> Could I get round the single value limitation with something like:
>
> IN ((SELECT 'abc','def' FROM myTable))
Maybe what you intend is more like this:
IN (SELECT 'abc' UNION ALL SELECT 'def' UNION ALL SELECT 'ghi'... etc.)
alternate:
IN (SELECT A FROM B)
- assuming table B contains a column A that already contains all the values you
need to include in the IN.
> Also, in the LIKE example, looks like I don't need single quote delimiters
> around the pattern?
The quote delimiters enables passing the value within an SQLite
statement, it is not significant to the type of value or in any way
significant to the LIKE parsing.
You could as easily use an identifier or parameter sans quotes, but if
you wish to compare like-ness by giving a string directly in an SQL
statement, it has to be contained in single quotes. That is purely
because of string-passing semantics in general. This means the following
examples all do the same thing:
"SELECT A, 'abc%' FROM B WHERE C LIKE 'abc%';"
"SELECT A, :1 FROM B WHERE C LIKE :1;" passing the value: abc%
"SELECT A, D FROM B WHERE C LIKE D;" assuming this is a sub-select
within another query of which there is a column D that contains a value
like: abc%
(I may have misinterpreted what you meant, if so, apologies - feel free
to ask again)
Cheers!
Ryan