Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GreenDao query OR within AND

Tags:

greendao

I would like to build the following query using GreenDao.

select * from luckydrawclick e where e.user = ? and (e.id = ? or e.id = ? or e.id = ? or e.id = ? or e.id = ?);

The following is what I have so far.

List<LuckyDrawClick> luckyDrawClicks = luckyDrawClickDao.queryBuilder().where(Properties.User.eq(currentUser)).and(**********).list();

What do I need to place where ********** is?

like image 701
Sandah Aung Avatar asked Nov 28 '25 16:11

Sandah Aung


1 Answers

I have found the answer to my own question.

QueryBuilder<LuckyDrawClick> qb = luckyDrawClickDao.queryBuilder();     
qb.where(Properties.Id.in(ids), Properties.User.eq(currentUser));
List<LuckyDrawClick> luckyDrawClicks = qb.list();
like image 154
Sandah Aung Avatar answered Dec 02 '25 04:12

Sandah Aung



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!