Reputation: 74066
I have never used NOT
in a query so I don't know if this is right.
Cursor c = getActivity().getContentResolver().query(Games.TOTALS_URI,
new String[] {Games.TOTALS_FRAME_TOTAL},
Games.TOTALS_FRAME_NUM+"=10"+" AND "+Games.TOTALS_FRAME_TOTAL+" NOT 0",null,null);
I want to get a value only if it is not 0
or even > 0
so would that be right?
Upvotes: 0
Views: 156
Reputation: 1904
Your instinct was correct, it should be > 0:
" AND "+Games.TOTALS_FRAME_TOTAL+" > 0"
Or better yet, to handle the case where Games.TOTALS_FRAME_TOTAL
might be NULL, wrap it in a COALESCE() function:
" AND COALESCE("+Games.TOTALS_FRAME_TOTAL+", 0) > 0"
The COALESCE function accepts a list of values and returns the first non-NULL value.
Upvotes: 1