如果 select 语句中没有行,则此语句错误(select top 1...)
update tHomePageWorking
set nColumn = 2,
nPosition = ((select top 1 nPosition
from tHomePageWorking
where nColumn = 2
order by nPosition desc) + 1
)
where nPosition = 1 and nColumn = 1
有没有办法测试这个语句的计数,如果没有找到记录,则默认为 1?
select top 1 nPosition
from tHomePageWorking
where nColumn = 2
order by nPosition desc