Recently I got to know that raw query in android can not prevent SQL injection and thus I decided to convert all queries in Prepared statement which is SQL injection prevention. But I don't know how to convert complex queries in Prepared Statement.

I want to convert below queries:

1.

```
select
    *
FROM
    TableName
where
    (tab1col1 in(SELECT tab2Col2 FROM MasterTable where tab2col1='Y')
    or  tab1col2 = CV.TRUE)
order by
    tab1col3, tab1col4, tab1col5,tab1col6

```

2.

```
Select
    * ,count(*) as TOTAL_COUNT ,
    SUM(CASE WHEN tabCol1 LIKE '%todayDate%' THEN 1 ELSE  0 END) as  TOTAL_COL1_COUNT
from
    TableName
group by tabCol2;

```