Placing the where condition
Posted
by
user182944
on Stack Overflow
See other posts from Stack Overflow
or by user182944
Published on 2012-04-14T11:21:50Z
Indexed on
2012/04/14
11:29 UTC
Read the original article
Hit count: 150
I came up with the below query:
SELECT ROOMNO,BUILDINGNO
FROM MRM_ROOM_DETAILS
WHERE ROOMID IN (
SELECT distinct roomid
FROM MRM_BOOKING_DETAILS
WHERE (CHECKIN NOT BETWEEN '2012-04-13 09:50:00' AND '2012-04-13 10:20:00')
AND (CHECKOUT NOT BETWEEN '2012-04-13 09:50:00' AND '2012-04-13 10:20:00'))
AND CAPACITY > 15
AND PROJECTIONSTATUS = 'NO';
I need to place this query in the method SQLiteDatabase.query() and fetch the rows accordingly. I am not able to understand how to place this big where condition (which contains a sub-query as well) in place of the "String selection" i.e. 3rd parameter of the method. Shall i simple write the entire where part(including the sub-query) as a string in the 3rd parameter or else there is some other better way for doing the same?
Please suggest me the best way to do the same.
Regards,
© Stack Overflow or respective owner