查询 count(*)>=1 AND site2BEARNG<=60 @avgno1mrn=select avg(no1mrn) from map_ncs_cellcover as h1 where ncellid in (
select top 3 ncellid from map_ncs_cellcover as h2 where h1.cellid=h2.cellid and nbearing<=60
order by ncellavgdis asc
) group by cellid=====================================
当count(*)<=0 CN120AVGD=-1@num=select count(*) from map_ncs_cellcover as h1 where ncellid in (
select ncellid from map_ncs_cellcover as h2 where h1.cellid=h2.cellid and Site2BEARING<=60
) group by cellid
======================================update map_ncs_cellcover SET NC120AVGD =CASE
when @uu<=0 then -1
when @uu>=1 then
avgno1mrn from
(
select avg(no1mrn) as avgno1mrn ,cellid from map_ncs_cellcover as h1 where ncellid in
(
select top 3 ncellid from map_ncs_cellcover as h2 where h1.cellid=h2.cellid and Site2BEARING<=60
order by ncellavgdis asc
) group by cellid
)bb where map_ncs_cellcover.cellid=bb.cellid这个结果是错误的! 请给我一个正确的答案! 谢谢各位啦
select top 3 ncellid from map_ncs_cellcover as h2 where h1.cellid=h2.cellid and nbearing<=60
order by ncellavgdis asc
) group by cellid=====================================
当count(*)<=0 CN120AVGD=-1@num=select count(*) from map_ncs_cellcover as h1 where ncellid in (
select ncellid from map_ncs_cellcover as h2 where h1.cellid=h2.cellid and Site2BEARING<=60
) group by cellid
======================================update map_ncs_cellcover SET NC120AVGD =CASE
when @uu<=0 then -1
when @uu>=1 then
avgno1mrn from
(
select avg(no1mrn) as avgno1mrn ,cellid from map_ncs_cellcover as h1 where ncellid in
(
select top 3 ncellid from map_ncs_cellcover as h2 where h1.cellid=h2.cellid and Site2BEARING<=60
order by ncellavgdis asc
) group by cellid
)bb where map_ncs_cellcover.cellid=bb.cellid这个结果是错误的! 请给我一个正确的答案! 谢谢各位啦
http://topic.csdn.net/u/20091130/21/fb718680-98ff-4afb-98d8-cff2f8293ed5.html?24281
select avg(no1mrn) as avgno1mrn ,cellid from map_ncs_cellcover as h1 where ncellid in
(
select top 3 ncellid from map_ncs_cellcover as h2 where h1.cellid=h2.cellid and Site2BEARING<=60
order by ncellavgdis asc
) group by cellid 就是不知道如何把avgno1mrn 赋值给NC120AVGD
IF @uu>1
BEGIN
select avg(no1mrn) as NC120AVGD ,cellid from map_ncs_cellcover as h1 where ncellid in
(
select top 3 ncellid from map_ncs_cellcover as h2 where h1.cellid=h2.cellid and Site2BEARING<=60
order by ncellavgdis asc
) group by cellid
END
ELSE
select avg(no1mrn) as avgno1mrn ,cellid from map_ncs_cellcover as h1 where ncellid in
(
select top 3 ncellid from map_ncs_cellcover as h2 where h1.cellid=h2.cellid and Site2BEARING<=60
order by ncellavgdis asc
) group by cellid
兄弟 你说的是这个意思不?