I have the following query in my dbhelper class.
public Cursor search(String searchString,String limit){
searchString=searchString.replaceAll("'", "");
String[] cols = new String[]{CSV_WORD_ID, CATEGORY_ID, MAIN_TEXT, TRANSLATION_TEXT, PRONUNCIATION_IN_ENGLISH, IMAGE_1,IMAGE_2,IMAGE_3,AUDIO,STATUS};
Cursor mCursor = database.query(true, WORD_TABLE, cols, CATEGORY_ID + " NOT IN(0,1) AND "+ MAIN_TEXT + " LIKE '%"+searchString+"%' ", null, MAIN_TEXT, null, null, limit);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;
}
In the above function I want to fetch distinct MAIN_TEXT. But in log I can see it is:-
SELECT DISTINCT csv_word_id, category_id, main_text, translation_text, pronunciation_in_english, image_1, image_2, image_3, audio, status FROM words WHERE category_id NOT IN(0,1) AND main_text LIKE '%m%' GROUP BY main_text LIMIT 10
I want DISTINCT main_text not csv_word_id. How can I do this.
Aucun commentaire:
Enregistrer un commentaire