0

在执行这个查询时,我总是只得到“0”的特许权结果,我总共得到了 20 万个客户数据,但是对于所有客户,我只得到了“0”的特许权值,我在这些查询中犯了什么错误?

-- 4. 特许权和其他预购

if (select count(*) FROM tbl_OrderFoodLog where OrderLog_ID in
    (select OrderLog_ID from  #MemberOrderLog where Member_MailId=@EmailId))>0

if (select count(*) from  #CustTrans where  OrderLog_IsFoodOrder='Y')>0
begin
    select  @Concession=(select SUM( FoodLog_Total) FROM tbl_OrderFoodLog where OrderLog_ID --in ( select OrderLog_ID from  #MemberOrderLog where Member_MailId=@EmailId))/
--(select -COUNT(*) from  #MemberOrderLog where Member_MailId=@EmailId) 
    select @FoodAmount=cast(SUM( FoodLog_Total) as float) FROM tbl_OrderFoodLog where OrderLog_ID in ( select OrderLog_ID from  #CustTrans where  OrderLog_IsFoodOrder='Y')
    select  @Concession=(@FoodAmount)/@Frequency
            end
        else
            begin
                select @Concession=0.00
            end

提前致谢

4

0 回答 0