Subject | Re: [firebird-support] Joining table in UPDATE statement? |
---|---|
Author | Alexandre Benson Smith |
Post date | 2006-11-20T19:29:33Z |
Anthony Tanas wrote:
Try this:
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 PATIENT.INACTIVEPATIENT = 'F' AND PATIENTRECALL.PATIENTID = PATIENT.PATIENTID)
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br
> I'm trying to do this:Hi Anthony,
>
> 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.
>
Try this:
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 PATIENT.INACTIVEPATIENT = 'F' AND PATIENTRECALL.PATIENTID = PATIENT.PATIENTID)
see you !
--
Alexandre Benson Smith
Development
THOR Software e Comercial Ltda
Santo Andre - Sao Paulo - Brazil
www.thorsoftware.com.br