Reputation: 75
I am trying to use order by clause...
My code...
db.rawQuery("select * from pd_data where item_type=1 and item_date like '%" + month + "%' order by date(item_date) DESC Limit 1", null);
But this only returns one value...
My date format dd MMM yyyy
.
How can i resolve this issue..?
Is it possible to sort dd MMM yyyy
date format using order by clause..?
Upvotes: 0
Views: 54
Reputation: 417
The One value returing is due to Limit 1
at the end of the query.
Try this
db.rawQuery("select * from pd_data where item_type=1 and item_date like '%" + month + "%' order by item_date DESC ", null);
Upvotes: 1
Reputation: 1070
"This only returns one value", try to remove the Limit 1
at the end of your query. And yes it is possible to sort your date with the Order By clause.
Upvotes: 1