本文主要是介绍GreenDao 查询(in用法),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
亲测可用,如有问题请私信!
两个表关联查询
原生语句:
select * from city where id in (select cityid from deliveryplace)
GreenDao语句:
List<City> list = DBCore.getDaoSession().getCityDao().queryBuilder()
.orderAsc(CityDao.Properties.Pinyin)
.where(new WhereCondition.StringCondition("id in" + "(select cityid from deliveryplace)"))
.build()
.list();
三个表关联查询
原生语句:
select SourcePlace.* from SourcePlace, Source_Brand_Relation where Source_Brand_Relation.BrandID = %ld and Source_Brand_Relation.SourcePlaceID = SourcePlace.ID
1
GreenDao语句:
List<SourcePlace> list = DBCore.getDaoSession().getSourcePlaceDao().queryBuilder()
.orderAsc(SourcePlaceDao.Properties.Pinyin)
.where(new WhereCondition.StringCondition("id in" + "(select sourceplaceid from source_brand_relation where brandid = ?)", id))
.build()
.list();
在此记录!
这篇关于GreenDao 查询(in用法)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!