SELECT SUM(CASE WHEN dbo.CP_Withdrawal.CateId=5 THEN dbo.CP_Withdrawal.Moneyoperate ELSE 0 END ) AS MoneyIn, SUM(CASE WHEN dbo.CP_Withdrawal.CateId=6 THEN dbo.CP_Withdrawal.Moneyoperate ELSE 0 END ) AS MoneyOut, SUM(CASE WHEN dbo.CP_Withdrawal.CateId=1 THEN dbo.CP_Withdrawal.Moneyoperate ELSE 0 END ) AS BetMoney, SUM(CASE WHEN dbo.CP_Withdrawal.CateId=4 THEN dbo.CP_Withdrawal.Moneyoperate ELSE 0 END ) AS PctMoney, SUM(CASE WHEN dbo.CP_Withdrawal.CateId=3 THEN dbo.CP_Withdrawal.Moneyoperate ELSE 0 END ) AS WinMoney, (SUM(CASE WHEN dbo.CP_Withdrawal.CateId=3 THEN dbo.CP_Withdrawal.Moneyoperate ELSE 0 END )+SUM(CASE WHEN dbo.CP_Withdrawal.CateId=4 THEN dbo.CP_Withdrawal.Moneyoperate ELSE 0 END )-SUM(CASE WHEN dbo.CP_Withdrawal.CateId=1 THEN dbo.CP_Withdrawal.Moneyoperate ELSE 0 END )) AS ProfitLoss, dbo.CP_Users.Id AS UID, dbo.CP_Users.Username AS UserID, dbo.CP_Users.Role AS RoleName FROM dbo.CP_Users LEFT JOIN dbo.CP_Withdrawal ON dbo.CP_Users.Id=dbo.CP_Withdrawal.Uid WHERE dbo.CP_Users.Id={0} AND dbo.CP_Withdrawal.Time BETWEEN '{1}'
如果本文引用了你的文章而未注明,请及时联系我。