on 04-24-2018 4:36 AM
Good Day,
Idk if this is possible to join those tables but i want to achieve is
Cardcode,Account Balance,PDC
please see below my query codes
Select T0.CardCode,T0.CardName,(SUM(T1.Debit)- SUM(T1.Credit)) AS Balance From OCRD T0 Inner Join JDT1 T1 on T0.CardCode=T1.Shortname Right join Ochh T2 on T0.CardCode=T2.CardCode Where T0.Cardtype='c' Group By T0.CardCode,T0.CardName Having (SUM(T1.Debit)- SUM(T1.Credit))!=0
Thanks for the Answer,
I already solved my problem in this query,
Declare @CustCode varchar(8000)
set @Custcode=(select S1.CardCode from OCRD S1 where S1.CardCode='[%0]')
Select T0.cardcode,T0.Cardname, (select sum(J0.debit-J0.credit)
from JDT1 J0 where j0.shortname=T0.Cardcode) as balance,
(SELECT sum(T1.[CheckSum]) FROM OCHH T1 WHERE T1.Deposited = 'N' and T1.Canceled ='N' and T1.[CashCheck] IN ('Chk Clr-Mnl','Chk Clr-Naga','Chk Clr-Cal','Chk Clr-Lucena') and T1.CardCode = T0.CardCode) as PDC,
(SELECT sum(T2.[CheckSum]) FROM OCHH T2 INNER JOIN ODPS T3 ON T2.DpstAbs = T3.DeposId WHERE T2.cardcode=t0.cardcode and T3.[DeposDate]>=getdate()) as 'Uncleared Check'
from OCRD T0
Where T0.Cardtype='C' and T0.Cardcode=@Custcode
Group By T0.CardCode,T0.CardNAme
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
9 | |
7 | |
6 | |
6 | |
3 | |
3 | |
3 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.