Fetch Data From Multiple Table Ormlite
I need to write following Query in ORMLite SELECT * FROM T1 t1, T2 t2 where t1.id = t2.id AND t1.type='abc' AND (t1.title = 'XYZ' OR t2.description = 'xyz'); However So Far I have
Solution 1:
For people with same problem
I have resolved this problem with change in query
SELECT*FROM T1 WHERE type='abc'AND (title ='XYZ'OR id IN (SELECT id from T2 where description ='xyz'));
QueryBuilder<T1, Integer> t1QB = getT1Dao().queryBuilder();
QueryBuilder<T2, Integer> t2QB = getT2Dao().queryBuilder();
t2QB.where().eq(id, id);
Where<T1, Integer>where= t1QB.where();
where.or(
where.ne("title", "XYZ"),
where.in("id", t2QB);
);
where.and().eq("Type", "abc");
Post a Comment for "Fetch Data From Multiple Table Ormlite"