如何用IN关键字比较忽略大小写

时间:2019-04-26 19:07:28

标签: sql scope azure-cosmosdb azure-cosmosdb-sqlapi

在Cosmos Scope / SQL中,如何比较列国家和忽略大小写的值列表。

SELECT * FROM student WHERE student_name IN ("aLpHa", "BetA", "GamMa")

2 个答案:

答案 0 :(得分:2)

以下查询应在cosmosdb中工作

select * from json j where LOWER(j.student_name) IN ("alpha", "beta", "gamma")

enter image description here

您也可以拥有UDF

udf:

function convertLower(str){
    return str .toLowerCase();
}

并将其用作

SELECT * FROM c where udf.lowerConvert(c.student_name) IN ("alpha", "beta", "gamma")

答案 1 :(得分:1)

您可以使用lower()

SELECT * FROM student WHERE lower(student_name) IN ("alpha", "beta", "gamma")

或者分别使用用户upper()