开发者

Is FMDatabase having troubles with "NOT IN" or doesn't SQLite on iPhone support it?

开发者 https://www.devze.com 2023-03-09 03:58 出处:网络
I\'m facing a serious problem with FMDatabase. I\'m using a query like the following SELECT * FROM `article` WHERE `alias` NOT IN (\'example_alias\')

I'm facing a serious problem with FMDatabase. I'm using a query like the following

SELECT * FROM `article` WHERE `alias` NOT IN ('example_alias')

I'm using 'NOT IN' because instead of 'example_alias' there could be a list of aliases which I want to exclude. But oddly the result of this query includes all records with the alias I want to exclude. So FMDatbase is selecting the wrong records. If I copy & paste this query into SQLite Database Browser and execute it there the query is done right.

If I remove 'NOT' in front of 'IN' then SQLite Database Browser is showing me all records with the given alias and, as expected, FMDatabase is giving me all records without them...

In the next step I want to replace SELECT with DELETE, but开发者_JS百科 it does really hurt if all unwanted records are kept and records I want to keep are deleted.

Is this a known bug of FMDatabase or the underlying SQLite framework (I'm using libsqlite3.dylib) or am I doing something wrong?


In foxpro the subquery needs to specified as another sql select statement .. SELECT * FROM article WHERE alias NOT IN (select * from 'example_alias') Could this be the solution?

0

精彩评论

暂无评论...
验证码 换一张
取 消