本文介绍了SQLite合并两列的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在基于某种逻辑尝试从数据库中获取get
数据,这是查询
String sql = "SELECT pr.number, pr.u_id from pro_cap pr " +
"LEFT OUTER JOIN pending p " +
"WHERE p.mobile_id = pr.u_id+pr.infant_no ";
待处理表中的 mobile_id 的value
为4711
value
是471
,数字的值是1
我想从4711 = 4711的数据库中获取数据,但无法获取...
解决方案
要连接两个或更多列,请使用||
运算符.
按如下所示更改查询:
String sql = "SELECT pr.number, pr.u_id from pro_cap pr " +
"LEFT OUTER JOIN pending p " +
"WHERE p.mobile_id = pr.u_id || pr.infant_no ";
I am trying get
data from database based on some logic, here is the query
String sql = "SELECT pr.number, pr.u_id from pro_cap pr " +
"LEFT OUTER JOIN pending p " +
"WHERE p.mobile_id = pr.u_id+pr.infant_no ";
Where, value
of mobile_id in pending table is 4711
And value
of u_id is 471
and value of number is 1
in pro_cap table
I suppose to get data from database where 4711 = 4711, but unable to get...
解决方案
For concatenating two or more columns use ||
operator.
Change your query as below :
String sql = "SELECT pr.number, pr.u_id from pro_cap pr " +
"LEFT OUTER JOIN pending p " +
"WHERE p.mobile_id = pr.u_id || pr.infant_no ";
这篇关于SQLite合并两列的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!