我正在使用 JSL 从 MySQL 数据库检索数据。但是,我遇到了一个问题,即我的 SQL 查询中的过滤条件默认不区分大小写。这意味着无论过滤值的大小写如何,返回的结果都是相同的。
以下是产生相同结果的两个脚本:
脚本1:
New SQL Query(
Version( 130 ),
Connection(
"ODBC:DATABASE=my_database;DSN=my_dsn;PORT=3306;PWD=my_password;SERVER=localhost;UID=my_user;"
),
QueryName( "test_data" ),
Select(
Column( "Column1", "t1" ),
Column( "Column2", "t1" ),
Column( "Column3", "t1" )
),
From( Table( "test_data", Alias( "t1" ) ) ),
Where(
Not Or(
In List(
Column( "Column1", "t1" ),
{"A"},
UI( SelectListFilter( ListBox, Base( "Categorical" ) ) )
)
)
)
) << Run;
脚本2:
New SQL Query(
Version( 130 ),
Connection(
"ODBC:DATABASE=my_database;DSN=my_dsn;PORT=3306;PWD=my_password;SERVER=localhost;UID=my_user;"
),
QueryName( "test_data" ),
Select(
Column( "Column1", "t1" ),
Column( "Column2", "t1" ),
Column( "Column3", "t1" )
),
From( Table( "test_data", Alias( "t1" ) ) ),
Where(
Not Or(
In List(
Column( "Column1", "t1" ),
{"a"},
UI( SelectListFilter( ListBox, Base( "Categorical" ) ) )
)
)
)
) << Run;
How can I modify the New SQL Query function in my JSL scripts to make the filtering conditions case-sensitive?
感谢您的帮助!
JMP 的人员很可能更了解,但您知道 SQL 查询是什么样子的吗?我认为您可以通过转换为自定义 SQL 来查看它

另外,您的数据库是如何配置的?如果您在其他应用程序中运行查询,是否会得到相同的结果?我不熟悉 MySQL,但也许默认情况下它们不区分大小写https://dev.mysql.com/doc/refman/8.4/en/case-sensitivity.html
SQL语句类似这样:
SELECT t1.`Column1`, t1.`Column2`, t1.`Column3`
FROM test_data t1
WHERE ( NOT ( ( ( t1.`Column1` IN ( 'A' ) ) ) ) ) ;
I know that adding the BINARY keyword in SQL can enforce case sensitivity, for example:
SELECT `Column1`, `Column2`, `Column3`
FROM `test_data` AS `t1`
WHERE BINARY `Column1` NOT IN ('A');And using the open Database function, I can execute SQL statements directly. However, I am particularly interested in whether the New SQL Query function in JSL can achieve the same case-sensitive effect.
谢谢您的帮助!
Got it, that would be similar to referencing SQL statements in open Database功能。谢谢!