[英]How to write and in one Compare in GOSU
我在下面有一個查詢,需要將 2nd 和 3rd.compare 條件與“AND”運算符結合起來
var query = ii.join(InvoiceItem#PolicyPeriod)
.compare(PolicyPeriod#Plan, Relop.NotEquals, xyzPlan)
.compareIn(PolicyPeriod#ProdType, {Prod.TC_FREE, Prod.TC_UNIQ})
.compareIn(PolicyPeriod#Elig,{OffElig.TC_Yes})
第二個 compareIn 語句應該如下 SQL 但不知道如何使用 AND 運算符將兩個變量組合在一個比較中。
if ( prodtype in ('FREE','UNIQ') and Elig = 'YES')
Any Advice!!
您可以使用 QueryAPI 中的.and()
方法:
var query = ii.join(InvoiceItem#PolicyPeriod)
.compare(PolicyPeriod#Plan, Relop.NotEquals, xyzPlan)
.and(\and1 -> {
and1.compareIn(PolicyPeriod#ProdType, {Prod.TC_FREE, Prod.TC_UNIQ})
and1.compareIn(PolicyPeriod#Elig, {OffElig.TC_Yes})
})
以同樣的方式,您可以使用.or()
方法,甚至可以將and()
和or()
組合在一個語句中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.