Subject Re: [ib-support] SQL Question
Author R. Tulloch
Hi:

> In a SP, you can work a cursor on the joined structure...
> ...
> AS
> CREATE VARIABLE MEMID INTEGER;
> BEGIN
> FOR SELECT M2.ID FROM MEMPAY2 M2
> JOIN MEMBERS M ON M2.ID = M.ID
> AND M2.RENEW_DATE = M.RENEW_DTE
> WHERE M.ID = M3.ID
> AND (M.STATUS_MEM = 'ACTIVE' OR M.STATUS_MEM = 'ASSOCIATE')
> AND M2.DATE_PAID IS NULL AND
> AND M2.REMIND_LET IS NULL
> AND M2.RENEW_DATE IS NOT NULL
> AND (M2.RENEW_DATE >= '05/04/2002' AND M2.RENEW_DATE <= '07/18/2002')
> INTO :MEMID DO
> BEGIN
> UPDATE MEMPAY M3
> SET REMIND_LET = :InvoiceDate
> WHERE M3.ID = :MEMID;
> END;
> END;
>

But this will update every child record with ID = :MEMID
and not just the one where ID = :MEMID and M2.RENEW_DATE =
M.RENEW_DTE.

Not a problem. I will try with the SP passing it invoice date,
start date and colse date.