android - Sort By in Sqlite -
this raw query contain left join , make list ascending order student_name.
i want pass order student_details.student_name asc outside query. (i want make asc desc).
how implement in raw query?
cursor = db.rawquery( "select * student left join student_details on student.student_id=student_details.student_id student.start_date <= ? , student.expired_date >= ? order student_details.student_name asc", new string[]{date, date} );
just make query depends on needs
string addictionalstate = "asc"; if (something) addictionalstate = "desc"; cursor = db.rawquery( "select * student left join student_details on student.student_id=student_details.student_id student.start_date <= ? , student.expired_date >= ? order student_details.student_name "+addictionalstate , new string[]{date, date} );
or can pass results list/hashmap , sort need.
Comments
Post a Comment