SQL SELECT Statement problem

Peter Haworth pete at lcsql.com
Wed Sep 2 15:52:06 EDT 2015


Having an issue with the following statement in SQLite.

SELECT col1,col2 FROM TableA WHERE colid IN (:1)

This is executed with

put revQueryDatabase(gdbid,tsql,"tArray") into tCursor

If tArray[1] contains a single integer, the SELECT works, if tArray[1]
contains a comma separated list of integers, no records are returned, even
though I know there are qualifying entries.

If I replace ":1" in the SELECT with 1,2 the rows are correctly returned,
but if tArray[1] contains 1,2 then no rows are returned.

On another related issue, I remember a discussion about the correct syntax
for using a parameter list variable with a LIKE statement but can't find
it.  I have tried:

LIKE ':1' with :1 containing %abc%
LIKE '%:1%' with :1 containing abc
LIKE :1 with :1 containing '%abc%'

None of these return the correct data.  Anyone remember how to get this to
work?



More information about the use-livecode mailing list