You*_*shi 0 sqlite android join
我在sqlite查询中使用like关键字时面临一些奇怪的问题inner join.
我想获取category_code上的记录,因为category_code在两个表中以不同的字符串格式保存.所以我写下面的查询,但没有输出.
select categories.category_code, services.* from categories join services on services.category_code like '%' + categories.category_code + '%' where services.country_code like '%IN%'
Run Code Online (Sandbox Code Playgroud)


有什么建议吗?
在SQLite中,+运算符是一个数学加法,而不是字符串连接符(就像它在其他RDBMS中,如SQL Server).对于SQLite中的字符串连接,请使用双管||.
select categories.category_code, services.*
from categories join services
on services.category_code like '%' || categories.category_code || '%'
where services.country_code like '%IN%'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1254 次 |
| 最近记录: |