没有NULL的SQLite

时间:2017-04-26 17:41:41

标签: android sqlite

我一直在努力获得专栏的最大价值。为此,我按DESC排序,所以最大的一个是第一个,但事实证明任何空值实际上都是出于某种原因。因此我尝试添加一个WHERE,但由于某种原因它仍然有空值,我无法弄清楚原因。

 String[] projection = {
            DATAbaseContract.DATAbaseEntry.COLUMN_PRICE,
    };
    String sortOrder =
            DATAbaseContract.DATAbaseEntry.COLUMN_PRICE + " DESC";

    Cursor DATAbaseCursor = DATAbaseDb.query(
            DATAbaseContract.DATAbaseEntry.TABLE_NAME,                     // The table to query
            projection,                               // The columns to return
            ShipsContract.ShipsEntry.COLUMN_PRICE + " IS NOT NULL",                                // The columns for the WHERE clause
            null,                            // The values for the WHERE clause
            null,                                     // don't group the rows
            null,                                     // don't filter by row groups
            sortOrder                                 // The sort order
    );
    if(!DATAbaseCursor.moveToPosition(0)) {return;}
    PriceMaxVal=DATAbaseCursor.getInt(DATAbaseCursor.getColumnIndex(DATAbaseContract.DATAbaseEntry.COLUMN_PRICE));
    PriceMinVal=0;

0 个答案:

没有答案