日期:2014-05-17  浏览次数:20454 次

为什么我这段sql一直显示这在查询,高手帮我看看代码是否有问题
SELECT  mb.BUName 单位名称 ,
        p.ProjName 项目名称 ,
        ISNULL(SUM(s.Amount), 0) 计划销售金额 ,
        ISNULL(SUM(c.HtTotal), 0) 实际销售金额 ,
        ( SELECT    ISNULL(SUM(Amount), 0)
          FROM      dbo.s_Getin ,
                    dbo.s_Trade ,
                    dbo.p_Room
          WHERE     dbo.s_Getin.SaleGUID = dbo.s_Trade.TradeGUID
                    AND dbo.s_Trade.RoomGUID = dbo.p_Room.RoomGUID
                    AND dbo.p_Room.ProjGUID = s.ProjGUID
                    AND dbo.s_Getin.Status IS NULL 
                    AND dbo.s_Getin.ItemName='楼款'
                    OR dbo.s_Getin.ItemName='定金'
                    OR dbo.s_Getin.ItemName='首期'
                    OR dbo.s_Getin.ItemName='补差款'
                    OR dbo.s_Getin.ItemName='银行按揭'
                    OR dbo.s_Getin.ItemName='公积金'
        ) ,
        ISNULL(SUM(s.JHHKAmount), 0) 计划回款金额 ,
        ISNULL(SUM(s.Bldarea), 0) 计划销售面积 ,
        ISNULL(SUM(s.Rooms), 0) 计划销售套数
FROM    dbo.s_SalesBudget s
        INNER JOIN ( SELECT BUGUID ,
                            BUName
                     FROM   dbo.e_myBusinessUnit
                   ) mb ON mb.BUGUID = s.BUGUID
        INNER JOIN ( SELECT ProjGUID ,
                            ProjName
            &n