0
我試圖對sqlite做查詢。我想檢索與配置文件ID(我有該配置文件的ID)無關的服務器的服務器ID。表serpro表示表之間的n:n關係。Sqlite故障做查詢
這是我的查詢(顯然這是錯誤的):
Select server._id, server.server
from server where server._id != (SELECT server._id FROM server
INNER JOIN serpro ON server._id = serpro._ids
INNER JOIN profile ON profile._id = serpro._idp
where profile._id=" + idProfile;
而這些都是在創建表的語句:
create table server (_id integer primary key autoincrement,ip string not null, port string not null, server string not null);
create table profile (_id integer primary key autoincrement, profile string not null);
create table serpro (_ids integer not null, _idp integer not null, PRIMARY KEY (_ids, _idp), CONSTRAINT fk_idsps FOREIGN KEY (_ids) REFERENCES server(_id) ON DELETE CASCADE, CONSTRAINT fk_idspp FOREIGN KEY (_idp) REFERENCES server(_id) ON DELETE CASCADE);
謝謝您的幫助!
您收到了什麼錯誤消息? – jabbie 2010-05-18 14:57:36
您的查詢構建容易受到SQL注入的影響。 – 2010-05-18 14:58:39