Convert SQL query to Android Azure Mobile Service query -
i have query works fine in azure sql database, i'm trying use within android application , can't work correctly. find overlaps in time bookings. here sql query dummy data, arrival , depart both integers:
select * bourguestmob.tableobjectbookings tabobjid = 28 , day = 30 , month = 3 , year = 2015 , ((arrival <= 1600 , depart > 1600) or (arrival< 1800 , depart >= 1800));
using mobile service provided, have use query like:
tableobjectbookingstable.where().field("tabobjid").eq(tables.get(i).getid()) .and().field("day").eq(day).and().field("month").eq(month).and().field("year").eq(year) .and().field("arrival").lt(inttime).or().field("arrival").eq(inttime).and().field("depart").gt(inttime)
that's have partially think part of query needs nested evaluated correctly.
i think want change end of query so:
.and(field("arrival").lt(inttime).or() .field("arrival").eq(inttime).and().field("depart").gt(inttime))
it helps me @ odata string check if right, take here samples of complex queries:
Comments
Post a Comment