Hi friends

I am using VFP6

I have a 2 tables has the following structure:

Ledger ( table 1)
---------------------
m_ac_no -primary key ( member id) a member can have more than 1 gac_no
(account no)
gac_no (account no. )
op_balance

voucher (table 2) its a daily transaction table
------------------
vid
m_ac_no
gac_no
vdate
vtype
dr
cr

Now I want single sql statement to get the opening and closing balance of
every member (m_ac_no) or specific member account (gac_no) balance on a
specifice period (x-date to y-date)

output will be like :

member id gacno op.ba.(opbal+(dr-cr)) cl.bal
((op.bal+dr)-cr)
(opbal+(dr-cr))
1001 101 1000 1520
1001 102 1522 2054
1001 105 1425 1020
1002 101 2541 2142
1002 105 2111 2541
and so on

the op.balance will be calculated on voucher table dr and cr field (total dr
-total cr) because one voucher (vid) is for one member (m_ac_no) but multiple
gac_no so we have to calculate for every member(m_ac_no) gac_no total dr and
cr.

I hope i explain it

kindly help me
thanks in advance
sanjib