select sum(reward_amt*cast((reward_status+1)/2 as int)) as in_reward, sum(reward_amt*cast(-1*(reward_status-1)/2 as int)) as out_reward from dbr_reward_bd where and branch_id = ? and buyer_id = ? and avail_date between '20240307' and '20240307';