请问以下句子如何改正?
select item1
from
(
select item1, ordering = CASE WHEN item2 IS NULL THEN 1 ELSE 0 END
from tableA
order by ordering
)
[解决办法]
select item1
from
(
select top 100 percent item1, ordering = CASE WHEN item2 IS NULL THEN 1 ELSE 0 END
from tableA
order by ordering
)a
[解决办法]
select item1
from
(
select top 100 percent item1, ordering = CASE WHEN item2 IS NULL THEN 1 ELSE 0 END
from tableA
order by ordering
)a
[解决办法]
(
select item1, ordering = CASE WHEN item2 IS NULL THEN 1 ELSE 0 END
from tableA
Where TableB.Item3 = TableA.Item3
order by ordering
)
--内有order by ,需要在select 后面加top ,所以会报错!
正确的为:
Update TableB
Set Item1 =
(
select TOP 1 item1
from
(
select top 100 percent item1, ordering = CASE WHEN item2 IS NULL THEN 1 ELSE 0 END
from tableA
Where TableB.Item3 = TableA.Item3
order by ordering
) a
)