简体   繁体   中英

how to limit the results from datastore of google app engine.?

Hello sir I am trying to get data from datastore of google app engine. I am executing following query to get data in descending order using app engine endpoint method.

Query highScorer = mgr.createQuery("select from CheckIn as CheckIn ORDER BY CheckIn.score DESC LIMIT 1");

Actually above query should give only one result but I am getting all entity in descending order. How to query for only one result.? Is there any thing wrong I am doing in Query? Thanks

Please let me know if i have to provide more information.

I got the solution. The above query should be written like below to get only one result.

Query highScorer = mgr.createQuery("select from CheckIn as CheckIn ORDER BY CheckIn.score DESC").setMaxResults(1);

Hope this will help someone. Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM