select count(*)*3+28 from Tg_BrandOrder
如上为啥不对呀???

解决方案 »

  1.   

    select cnt*3+28 from
    (
      select count(*) cnt from Tg_BrandOrder 
    ) t
      

  2.   


    --没问题呀,算得没错declare @表1 table (
    id  int,
    classid   int,
    name varchar(5)
    )insert @表1 select
    1, 1, 'S'
    union all select 
    2, 1, 'M'
    union all select 
    3, 1, 'L' 
    union all select 
    4, 2, '37' 
    union all select 
    5, 2, '38' 
    union all select 
    6, 2, '39' 
    union all select 
    7, 2, '40' 
    union all select 
    8, 2, '41' 
    union all select 
    9, 2, '42' 
    union all select 
    null, 3, '100' select count(*) from @表1select   count(*)*3+28   from   @表1--结果
               
    ----------- 
    10(所影响的行数为 1 行)            
    ----------- 
    58(所影响的行数为 1 行)
    --10*3+25=58
      

  3.   

    各位同仁对不起,我自己发错了!
    select RealPoit=(cast((select CJPoit=(count(*)*3+28)from Tg_BrandOrder where Status =1 and BrandID=1111) as int)+cast((select TSPoit=count(*)*(-12) from Tg_BrandOrder where Status =2 and BrandID=1111)as int))from Tg_BrandOrder where BrandID=1111 and Status in(1,2)
      

  4.   

    select RealPoit=((select CJPoit=(count(*)*3+28)from Tg_BrandOrder where Status =1 and BrandID=1111))+(select TSPoit=count(*)*(-12) from Tg_BrandOrder where Status =2 and BrandID=1111))from Tg_BrandOrder where BrandID=1111 and Status in(1,2)是这样
      

  5.   

    select RealPoit=((select CJPoit=(count(*)*3+28)from Tg_BrandOrder where Status =1 and BrandID=1111)+(select TSPoit=count(*)*(-12) from Tg_BrandOrder where Status =2 and BrandID=1111))from Tg_BrandOrder where BrandID=1111 and Status in(1,2)上面的也不对不好意思拷错了