干杯!
答案 0 :(得分:0)
您好使用此查询: -
String qry = "select userid FROM users WHERE Not EXISTS (SELECT friendId FROM friendsrelation WHERE friendsrelation.friendId =users.userID and friendsrelation.myid = currentuserID)";
Cursor objCursor = db.rawQuery(qry,null);
ArrrayList<Long> friendsids = new ArrrayList<Long>();
if ((objCursor != null) && (objCursor.getCount() > 0)) {
objCursor.moveToFirst();
while (objCursor.isAfterLast() == false) {
friendsids.add(objCursor.getLong(objCursor.getColumnIndex("userid ")));
}
}