Android - 在SQL查询中苦苦挣扎

时间:2014-04-17 07:32:48

标签: java android sql sql-server sqlite

在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中运行。请有人帮助我。

1 个答案:

答案 0 :(得分:1)

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