怎么进行select条件判断

weasea 2010-01-27 11:09:20
select
isnull
(curProcess=(SELECT top 1 description FROM tba,tbb WHERE (LOADCELL_ID = @cellID) and processnumber=process_id
and status<>0
order by process_index desc ),'')

from。。。。。。

isnull
(curProcess=(SELECT top 1 description FROM tba,tbb WHERE (LOADCELL_ID = @cellID) and processnumber=process_id
and status<>0
order by process_index desc ),'')

报错。


...全文
161 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
--小F-- 2010-01-27
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 weasea 的回复:]
如果 DESCRIPTION 不是null,而是空呢
谢谢
[/Quote]
select curProcess=
isnull
((SELECT top 1 description FROM tba,tbb WHERE (LOADCELL_ID = @cellID) and processnumber=process_id
and status <>0
order by process_index desc),'')
weasea 2010-01-27
  • 打赏
  • 举报
回复
如果 DESCRIPTION 不是null,而是空呢
谢谢
jack15850798154 2010-01-27
  • 打赏
  • 举报
回复
学习中!!帮顶!
chuifengde 2010-01-27
  • 打赏
  • 举报
回复
SELECT aa,
(SELECT top 1 isnull(DESCRIPTION,'') FROM tba,tbb WHERE (LOADCELL_ID = @cellID) and processnumber=process_id
and status <>0
order by process_index DESC
) bb
FROM [Table]
chuifengde 2010-01-27
  • 打赏
  • 举报
回复
SELECT top 1  isnull(DESCRIPTION,'') FROM tba,tbb WHERE (LOADCELL_ID = @cellID) and processnumber=process_id 
and status <>0
order by process_index desc
weasea 2010-01-27
  • 打赏
  • 举报
回复
行是行了,但是还是null,没得到 ''的值
奇怪啊
黄_瓜 2010-01-27
  • 打赏
  • 举报
回复
select curProcess=
isnull
((SELECT top 1 description FROM tba,tbb WHERE (LOADCELL_ID = @cellID) and processnumber=process_id
and status <>0
order by process_index desc),'')
水族杰纶 2010-01-27
  • 打赏
  • 举报
回复
--try
isnull
((SELECT top 1 description FROM tba,tbb WHERE (LOADCELL_ID = @cellID) and processnumber=process_id
and status <>0
order by process_index desc ),'')
水族杰纶 2010-01-27
  • 打赏
  • 举报
回复
--try
isnull
(SELECT top 1 description FROM tba,tbb WHERE (LOADCELL_ID = @cellID) and processnumber=process_id
and status <>0
order by process_index desc ),'')

34,576

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧