【问题标题】:Android - Struggling with SQL QueryAndroid - 与 SQL 查询作斗争
【发布时间】:2014-04-17 07:32:47
【问题描述】:

在 SQL Server 中,我有一个数据库和其中的表。在 Android 中,我创建了与 SQL Server 中的表同名的本地 SQLite 表,并且值也相同。

我正在使用以下查询来查看某些表的值。

Select Distinct w.WorkFlowID,w.WorkFlowName ,wv.WorkFlowValueID,wv.WorkFlowValueName,'work'as prodvalue,
case when wl.StartTime IS NOT NULL then 'true' else 'false' end
 from WorkFlow w left join WorkFlowValue wv on w.WorkFlowID = wv.WorkFlowID 
left join WorkflowLog wl on w.WorkFlowID=wl.WorkFlowID and wl.WorkFlowTransId='1' 
where w.productID='47' and (wv.WorkFlowTransId='1' or wv.WorkflowTransId is null ) and 
(w.IsDeleted=0 or w.IsDeleted is null)
UNION  
Select Distinct an.AttributeID,an.AttributeName,av.AttributeValueID,isnull(av.AttributeValueName,''),'attr' as prodvalue,'false' from Attribute an left join AttributeValue av on an.AttributeID=av.AttributeID
where an.productID='47' and (av.WorkFlowTransId is null or av.WorkFlowTransId='1') and  (an.IsDeleted='false' or an.IsDeleted is null)  order by prodvalue asc

我想在 Android 中使用这个查询,但是像 isnull 这样的一些函数在 android 中无法识别。我想让这个查询在 android 中工作。请任何人帮助我。

【问题讨论】:

    标签: java android sql sql-server sqlite


    【解决方案1】:

    对于ISNULL(),请使用IFNULL()COALESCE()

    【讨论】:

      猜你喜欢
      • 2019-04-20
      • 2021-03-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-29
      • 2021-11-25
      • 1970-01-01
      相关资源
      最近更新 更多