Subject Re: Joining table in UPDATE statement?
Author legrand_legrand_63
Perhaps something like :

UPDATE
PATIENTRECALL
SET
PATIENTRECALL.RECALLSTATUS = 'rsMail'
WHERE
PATIENTRECALL.RECALLDATE >= :STARTDATE AND
PATIENTRECALL.RECALLDATE <= :ENDDATE AND
PATIENTRECALL.RECALLSTATUS <> 'rsCancelled' AND
PATIENTRECALL.RECALLSTATUS <> 'rsRecalled'
and exists (select 1 from PATIENT
WHERE PATIENTRECALL.PATIENTID = PATIENT.PATIENTID
and PATIENT.INACTIVEPATIENT = 'F')

Regards
PAscal


--- In firebird-support@yahoogroups.com, "Anthony Tanas" <anthony@...>
wrote:
>
> I'm trying to do this:
>
> UPDATE
> PATIENTRECALL
> SET
> PATIENTRECALL.RECALLSTATUS = 'rsMail'
> FROM
> PATIENTRECALL
> INNER JOIN PATIENT ON (PATIENTRECALL.PATIENTID = PATIENT.PATIENTID)
> WHERE
> PATIENTRECALL.RECALLDATE >= :STARTDATE AND
> PATIENTRECALL.RECALLDATE <= :ENDDATE AND
> PATIENT.INACTIVEPATIENT = 'F' AND
> PATIENTRECALL.RECALLSTATUS <> 'rsCancelled' AND
> PATIENTRECALL.RECALLSTATUS <> 'rsRecalled'
>
> But it doesn't work...I also tried:
>
> UPDATE
> PATIENTRECALL
> INNER JOIN PATIENT ON (PATIENTRECALL.PATIENTID = PATIENT.PATIENTID)
> SET
> PATIENTRECALL.RECALLSTATUS = 'rsMail'
> WHERE
> PATIENTRECALL.RECALLDATE >= :STARTDATE AND
> PATIENTRECALL.RECALLDATE <= :ENDDATE AND
> PATIENT.INACTIVEPATIENT = 'F' AND
> PATIENTRECALL.RECALLSTATUS <> 'rsCancelled' AND
> PATIENTRECALL.RECALLSTATUS <> 'rsRecalled'
>
> Can someone point me in the right direction? Thanks in advance.
>