两个表关联查询
原生语句:
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
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();
在此记录!