Hi all. Im triying to do a query on sqlite. I want to retrieve the server id of the servers that are not associated with a profile id (i have the id of the profile). The table serpro represents the n:n relationship betwen the tables.
This is my query (apparently it is wrong):
"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;
And these are the table creation sentences:
"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);"
Thank you for your help!