这个咋处理呢?
会员卡号充值表LPU LPU01(单号) LPU03(会员卡号) LPU05(充值金额) LPU02(回馈金额)
00001 HY00001 1000 100
00002 HY00001 500 50
00003 HY00002 5000 500
00004 HY00003 1000 100
00005 HY00003 500 50
会员卡金额异动表LSN LSN03(单号) LSN01(会员卡号) LSN04(异动金额)
00001 HY00001 1000
00002 HY00001 500
00003 HY00002 5000
00004 HY00003 1000
00005 HY00003 500
会员卡回馈异动表LSN LSM03(单号) LSM01(会员卡号) LSM04(异动金额)
00001 HY00001 100
00002 HY00001 50
00003 HY00002 500
00004 HY00003 100
00005 HY00003 50
会员卡信息表LPJ LPJ03(会员卡号) LPJ06(会员卡余额) LPJ01(回馈余额)
HY00001 10000 500
HY00002 25000 1300
HY00003 8000 900
现在要根据前面三张表把会员卡信息的余额和回馈减掉,就是HY00001的余额10000-1500,回馈-150
HY0002的余额25000-5000,回馈-500,HY0003的余额8000-1500,回馈-150
------解决方案--------------------
楼上的是sb,select sum(lsn04)from lsn group by lsn01;
select sum(lsm04)from lsm group by lsm01
先把两表的异动统计一下,然后再当成一个表。然后再2表关联处理,具体的我也不知道怎么写