没细看至少得改成这样:
select sum(F_User_point) as wnpoint
from TB_CDR
where F_User_point in (select F_User_point
from TB_CDR
where Called_Station_Id in (select Called_Station_Id
from TB_CDR
where Calling_Station_Id='0429990100'
and convert (varchar(10),convert(dateTime, h323_connect_Time),112)like'200803%'
)
and Called_Station_Id like '042999%'
)
同一个表为什么要搞两次IN
select sum(F_User_point) as wnpoint
from TB_CDR
where F_User_point in (select F_User_point
from TB_CDR
where Called_Station_Id in (select Called_Station_Id
from TB_CDR
where Calling_Station_Id='0429990100'
and convert (varchar(10),convert(dateTime, h323_connect_Time),112)like'200803%'
)
and Called_Station_Id like '042999%'
)
同一个表为什么要搞两次IN
from TB_CDR
where F_User_point in ( select Called_Station_Id
from TB_CDR
where Calling_Station_Id='0429990100'
and convert (varchar(10),convert(dateTime, h323_connect_Time),112)like'200803%'
)
select sum(F_User_point) as wnpoint from TB_CDR where F_User_point in (select F_User_point from TB_CDR where Called_Station_Id in (select Called_Station_Id from TB_CDR where Calling_Station_Id='0429990100' and convert (varchar(10),convert(dateTime, h323_connect_Time),112)like'200803%') and Called_Station_Id like '042999%')
from TB_CDR
where F_User_point in
(select F_User_point from TB_CDR where Called_Station_Id in
(select Called_Station_Id from TB_CDR where Calling_Station_Id='0429990100' and convert (varchar(10),convert(dateTime, h323_connect_Time),112) like'200803%')
and Called_Station_Id like '042999%')