我需要过滤从 Derdy 获取数据的 Java 应用程序中的数据。我在 Derby 中创建了一个表,并使用下面的查询,该查询可在 MySQL 上运行,但不适用于 Derby。有人知道如何使查询与 Derby 兼容吗? 对于此查询,我需要按“搜索”按钮,它会在 JPanel 中提供结果。
Select * FROM fruits where concat (apple, orange, banana) LIKE '%"+ValToSearch+"%';
最佳答案
Derby 支持 + 进行字符串连接。
Concatenation
The concatenation operator, ||, concatenates its right operand to the end of its left operand. It operates on a character or bit expression.
Because all built-in data types are implicitly converted to strings, this function can act on all built-in data types.
使用||
来连接字符串,而不是使用concat
函数。
了解更多详情view this 。
关于java - 需要在 Derby 中编写正确的查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41376758/