Use of AND and OR in SQLite

前端 未结 1 459
我寻月下人不归
我寻月下人不归 2021-01-01 15:06

I want to access records from SQLite in android using rawQuery(query,arg). I have two columns in database one called friendsID and 2nd called

1条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-01 15:28

    I guess you mean something like this: "Get me all entries from emailTable where friendsID is fID and emailSenderID is either fID or myID." In that case you need to group it like this:

     SELECT * FROM emailTable WHERE friendsID=fID AND 
         (emailSenderID=fID OR
         emailSenderID=myID)
    

    0 讨论(0)
提交回复
热议问题