SQLite querybuilder BETWEEN子句

时间:2016-01-20 13:22:28

标签: android sqlite between

我想在应用程序中运行此查询:

SELECT Naslov, Kraj FROM Bankomati_db WHERE Banka=selectedBank AND ((ZemljepisnaSirina BETWEEN selectedLatDPod AND selectedLatDNad) AND (ZemljepisnaDolzina BETWEEN selectedLngDPod AND selectedLngDNad))

当我在数据库浏览器中运行它时会返回一些行,而在android中却没有。

我在应用程序中使用此代码:

public Cursor getBankomatCoordinates(){
    SQLiteDatabase db = getReadableDatabase();
    SQLiteQueryBuilder qb = new SQLiteQueryBuilder();

    String [] sqlSelect = {"0 _id", "Naslov", "Kraj"};
    String sqlTables="Bankomati_db";
    String sqlWhere="Banka=? AND ((ZemljepisnaSirina BETWEEN ? AND ?) AND (ZemljepisnaDolzina BETWEEN ? AND ?))";
    String [] args = {selectedBank, selectedLatDPod, selectedLatDNad, selectedLngDPod, selectedLngDNad};

    qb.setTables(sqlTables);
    Cursor c = qb.query(db, sqlSelect, sqlWhere, args, null, null, null);
    c.moveToFirst();

    return c;

}

0 个答案:

没有答案