我想通过 2 个子句过滤我的查询结果,但我不知道该怎么做,也找不到关于如何做的明确解释。以下是我尝试过的。
termList = SugarRecord.find(Term::class.java, "type = ? AND category = ?", "hcp, "+ parentCategoryId.toString())
谢谢!
我想通过 2 个子句过滤我的查询结果,但我不知道该怎么做,也找不到关于如何做的明确解释。以下是我尝试过的。
termList = SugarRecord.find(Term::class.java, "type = ? AND category = ?", "hcp, "+ parentCategoryId.toString())
谢谢!
例如:
val termList = SugarRecord.find(Term::class.java,
"type = ? and category = ?", // where clause
"hcp", parentCategoryId.toString()) // arguments
此外,您可以使用查询生成器:
val termList = Select.from(Term::class.java).where(
Condition.prop("type").eq("hcp"), // type =(equals) ?
Condition.prop("category").eq(parentCategoryId.toString())).list()