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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -