iPhone+;sqlite3+;无疑问

iPhone+;sqlite3+;无疑问,iphone,sqlite,Iphone,Sqlite,我想在代码中编写一个in查询。我的问题类似于: SELECT PlayerID, PlayerName, Type, BattingSkills, BallingSkills from Player where TeamId = 6 and PlayerID not in (163,174) order by battingSkills desc limit 4 在我的xCode中,我编写了如下查询 const char *sql = "SELECT PlayerID

我想在代码中编写一个in查询。我的问题类似于:

SELECT  PlayerID, PlayerName, Type, BattingSkills, BallingSkills 
from Player 
where TeamId = 6 
      and PlayerID not in (163,174) 
order by battingSkills desc 
limit 4
在我的xCode中,我编写了如下查询

const char *sql = "SELECT  PlayerID, PlayerName, Type, BattingSkills, BallingSkills                                                                    from Player where TeamId = ? LIMIT 11";

sqlite3_stmt *selectstmt;
if(sqlite3_prepare_v2(database, sql, -1, &selectstmt, NULL) == SQLITE_OK) 
{
    sqlite3_bind_int(selectstmt, 1, teamId);
    ..................
    }
现在,假设我想编写not in查询(如上面的SQL查询),我将如何在xCode中编写代码来传递not in ID。

这可能会起作用(传递值的方式与传递teamID的方式相同):

const char *sql = "SELECT  PlayerID, PlayerName, Type, BattingSkills, BallingSkills from Player where TeamId = ? and playerID not in (?, ?) LIMIT 11";
...
sqlite3_bind_int(selectstmt, 1, teamId);
sqlite3_bind_int(selectstmt, 2, notID1);
sqlite3_bind_int(selectstmt, 3, notID2);