高手请进!报表统计问题!
手头有一个报表要做,简化以后,大概模型如下:
有如下几张表:
tJJFE --记录了各个客户的每只基金的当前持有量
KHH JJZH JJDM JJSL
------------ ------------ ------ -----------------
000000000022 273600125785 270001 30002.00
000000001208 273600125730 270001 30002.00
000000002996 SQ8999999999 050001 30002.00
000009000016 050505050506 111001 2010002.00
000009000016 270000000007 270001 6800607002.00
000089500024 273600022981 270001 30002.00
001000000003 273600125796 270001 30002.00
011018000422 273600066512 270001 30002.00
011018000863 273600063659 270001 30002.00
011018001195 273600053551 270001 30002.00
tJJMXLS --历史基金变动明细
RQ KHH JJZH JJDM BDSL
---------- ------------ ------------ ------ ---------------------------------------
2005.03.24 311200000535 013600010514 111001 1011.00
2005.03.25 311200000963 273600125718 270001 10000.00
2005.10.31 311200000963 273600125718 270001 10000.00
2005.11.10 311200008620 000000000000 270001 1000000.00
2005.11.10 311200008620 000000000000 270001 20000000000.00
2005.11.10 311200008620 273200000006 270001 100000000.00
2006.05.16 311200000321 013600010569 202001 1000.00
tJJXXLS --历史基金行情
RQ JJDM JJJC JJJZ
---------- ------ ------------ ----------------
2005.03.24 202001 南方测试 1.300000
2005.03.24 202011 南方测试 1.500000
2005.03.25 202001 南方测试 1.300000
2005.03.25 202011 南方测试 1.500000
2005.10.31 202001 南方测试 1.300000
2005.10.31 202011 南方测试 1.500000
2005.11.10 202001 南方测试 1.300000
2005.11.10 202011 南方测试 1.500000
2006.05.09 202001 南方测试 1.300000
2006.05.09 202011 南方测试 1.500000
关联条件:
tJJFE.KHH=tJJMXLS.KHH AND tJJFE.JJZH=tJJMXLS.JJZH AND tJJFE.JJDM=tJJMXLS.JJDM
tJJFE.JJDM=tJJXXLS.JJDM
tJJMXLS