Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can get top of records by GreenDAO?

I wanna to get top some records from my table, but GreenDAO doesn't provide it. Like this:

SELECT TOP 1 * FROM table_name

In LINQ you can get top of records with Take(), is there any solution for GreenDAO?

Could every one offer a suggestion?

like image 259
Omid Nazifi Avatar asked Oct 20 '12 05:10

Omid Nazifi


1 Answers

You can specify a limit using standard QueryBuilder:

List<YourEntity> entities = yourDao.queryBuilder().limit(1).list();
like image 133
Markus Junginger Avatar answered Sep 26 '22 05:09

Markus Junginger