sqlite where子句条件

时间:2013-08-14 13:30:46

标签: android sqlite where-clause

我想检索数据库中的前20个项目,然后检索后面的20个项目,如选择变量中所示:

String selection = SQLite.firstTableColumns[8]+">="+0+" and "+SQLite.firstTableColumns[8]+"<"+20;
Log.d("search from db","selection "+selection+"  !!!!!!!!!!!");
Cursor cursor = SQLiteDataBase.query("feedFirstTable",SQLite.firstTableColumns,selection, null, null, null, null); 

但它返回一个空的ArrayList

1 个答案:

答案 0 :(得分:0)

您可以使用这些查询来解决您的问题:

sqlite> SELECT * FROM Cars LIMIT 4;
Id          Name        Cost      
----------  ----------  ----------
1           Audi        52642     
2           Mercedes    57127     
3           Skoda       9000      
4           Volvo       29000     
The LIMIT clause limits the number of rows returned to 4.

sqlite> SELECT * FROM Cars LIMIT 2, 4;
Id          Name        Cost      
----------  ----------  ----------
3           Skoda       9000      
4           Volvo       29000     
5           Bentley     350000    
6           Citroen     21000  
This statement selects four rows skipping the first two rows.