Sugar ORM order by

582 Views Asked by At

I'm using sugar ORM in Android to manage my data, but when I receive a list I want to order it in the query using "order by" but I don't find a real example of how to use it. Could somebody please give me an example? Thanks!

1

There are 1 best solutions below

0
Hassan Kazemy On

you can use this code:

List<BookTbl> list =   Select.from(BookTbl.class)
            .where(Condition.prop("Title").eq("my_")
            .orderBy("ISBN")
            .list();

Or :

List<BookTbl>  list =   DetailFileObserveTbl.findWithQuery(BookTbl.class,
        "SELECT * FROM Book_Tbl WHERE Title=? ORDER BY ISBN",
        "my_" );