The SQL statement below works fine unless there happens to be no data in Cardbal for a particualar card or date. How would I make the other part of the statement show data as all the other data is available.
Basically what I'm saying is that I would like a record for each client even if there is no aged balances or credits/debits.
Thanks
SELECT Title, Firstname, Surname,cardnum,IIF(cardbal.DATE = FROMDATE,CARDbal.balance,0000000000.00) AS AGEBAL, ;
Sum(TMPAMOUNT.Credit) as Credit , ;
Sum(TMPAMOUNT.Debit) as Debit, ;
IIF(cardbal.DATE = FROMDATE,CARDbal.balance,0.00) + (SUM(Credit) - SUM(Debit)) AS Total,;
CARD.BALANCE ;
INTO CURSOR TEMP ;
FROM TMPAMOUNT, CARD, CLIENT, CardBal;
WHERE TMPAMOUNT.cardnum = Card.Number ;
AND CardBal.Date = FromDate ;
AND CardBal.Number = Card.Number ;
&sFILTER ;
GROUP BY cardnum;
ORDER BY SURNAME, FIRSTNAME, TITLE
Basically what I'm saying is that I would like a record for each client even if there is no aged balances or credits/debits.
Thanks
SELECT Title, Firstname, Surname,cardnum,IIF(cardbal.DATE = FROMDATE,CARDbal.balance,0000000000.00) AS AGEBAL, ;
Sum(TMPAMOUNT.Credit) as Credit , ;
Sum(TMPAMOUNT.Debit) as Debit, ;
IIF(cardbal.DATE = FROMDATE,CARDbal.balance,0.00) + (SUM(Credit) - SUM(Debit)) AS Total,;
CARD.BALANCE ;
INTO CURSOR TEMP ;
FROM TMPAMOUNT, CARD, CLIENT, CardBal;
WHERE TMPAMOUNT.cardnum = Card.Number ;
AND CardBal.Date = FromDate ;
AND CardBal.Number = Card.Number ;
&sFILTER ;
GROUP BY cardnum;
ORDER BY SURNAME, FIRSTNAME, TITLE