I have a select statement which selects diseases in sqlite database based on symptoms dynamically generated by user... Here is the query:
SELECT D."+COLUMN_NAME+",group_concat( symp,',' ) AS conca,count(*) as SymptomsMatching FROM "+TABLE_LINKDS+ " DS JOIN "+TABLE_SYMPTOMS+" S ON DS."+COLUMN_SYMPTOMS_ID+"= S."+COLUMN_SYM_ID+ " JOIN "+TABLE_DISEASE+" D ON DS."+COLUMN_DISEASE_ID+"= D."+COLUMN_DS_ID+ " WHERE S."+COLUMN_SYMP+" IN ("+arrayOfSymptoms+") GROUP BY D.name ORDER BY SymptomsMatching DESC, D.name ASC";
Now i want to pass the array:String[] arrayOfSymptoms={"headache","nausea","chills"}
in the query such that the query would look something like this :
"SELECT D."+COLUMN_NAME+",group_concat( symp,',' ) AS conca,count(*) as SymptomsMatching FROM "+TABLE_LINKDS+
" DS JOIN "+TABLE_SYMPTOMS+" S ON DS."+COLUMN_SYMPTOMS_ID+"= S."+COLUMN_SYM_ID+
" JOIN "+TABLE_DISEASE+" D ON DS."+COLUMN_DISEASE_ID+"= D."+COLUMN_DS_ID+
" WHERE S."+COLUMN_SYMP+" IN ('headache','nausea','chills') GROUP BY D.name ORDER BY SymptomsMatching DESC, D.name ASC";
I tried using TextUtils.join() method and another custom but all dint work.