SQLite的查询比支票小于或大于 [英] SQLite query less than or greater than check

查看:161
本文介绍了SQLite的查询比支票小于或大于的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用这样的:

return mDb.query(DATABASE_TABLE, new String[] { KEY_ROWID, 
KEY_LEVEL }, KEY_LEVEL + ">= 3 AND " + KEY_LEVEL + " < 5", null, null, null, null);

但不是5我想它来检查下一列中找到大于或等于3。

But instead of 5 I want it to check the next column where it finds greater than or equal to three.

所以,当我给说5的投入,我想这比在下一列中的值,第4列少列3,但检查大于或等于5。

So when I give an input of say 5, I want it to check for greater than or equal to 5 in column 3 but less than the value in the next column, column 4.

从<一个采取原始code href="http://stackoverflow.com/questions/9692897/sqlite-query-check-less-than-and-greater-than">Sqlite查询支票 - 比小于和大于

推荐答案

只要做到这一点:

String[] selectionArgs = { "5", "5" };
String[] columns = { KEY_ROWID, KEY_COLUMN3, KEY_COLUMN4 };
String selection = "KEY_COLUMN3 >= ? AND KEY_COLUMN4 < ?";
return mDb.query(DATABASE_TABLE, columns, selection, selectionArgs, null, null, null);

这篇关于SQLite的查询比支票小于或大于的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆