Optional query parameters for Android Room
@Query("Select count() from savings_table" +
" left join ColInfo_table on col_orgNo = save_orgNo and col_orgMemNo = save_orgMemNo "+
" inner join VoList_table on VoList_table.vo_orgNo = savings_table.save_orgNo " +
"inner join CoList_table on CoList_table.co_coNo = VoList_table.vo_pin " +
" WHERE (:pin IS NULL OR co_coNo LIKE :pin) "
)
LiveData<List<GeneralSavingQueryModel>> getGeneralSavingByBranch(String pin);
where :pin is null then return all table value or if you input pin then return value with pinwise
this is called optional query parameters
" left join ColInfo_table on col_orgNo = save_orgNo and col_orgMemNo = save_orgMemNo "+
" inner join VoList_table on VoList_table.vo_orgNo = savings_table.save_orgNo " +
"inner join CoList_table on CoList_table.co_coNo = VoList_table.vo_pin " +
" WHERE (:pin IS NULL OR co_coNo LIKE :pin) "
)
LiveData<List<GeneralSavingQueryModel>> getGeneralSavingByBranch(String pin);
where :pin is null then return all table value or if you input pin then return value with pinwise
this is called optional query parameters
No comments