Subject | Re: UPDATE AND DELETE WITH JOIN |
---|---|
Author | Ian A. Newby |
Post date | 2006-07-12T11:00:15Z |
Hi Arno,
That one was just a suggestion, and your response was correct for
firebird, however, I can't see anyway to do something like
update project
set industrytypecode = c.funding
from (
select case
when p.funding is not null and c.customergroupcode <>
'LARGE' then p.funding
when r.region = 'Northwest' then 'NWDA'
else 'COMM'
end as funding, pj.projectcode, pj.revisionnum
from project pj
join projectrule pr on pj.projectcode = pr.projectcode
join opportunity o on pr.opportunityid = o.opportunityid
join TMICustomerProspect c on o.customerorprospectid = c.customerid
left join TMIPostcodeFunding p on upper(REPLACE(p.postcode,' ',''))
= upper(REPLACE(c.postalcode,' ',''))
left join TMIRegion r on c.postalcode like r.postcode + ' %'
where pj.industrytypecode is null
) as c
where project.projectcode = c.projectcode and project.revisionnum =
c.revisionnum
and coalesce(project.industrytypecode, '') <> c.funding
Without using stored procedures or execute block?
Regards
Ian Newby
That one was just a suggestion, and your response was correct for
firebird, however, I can't see anyway to do something like
update project
set industrytypecode = c.funding
from (
select case
when p.funding is not null and c.customergroupcode <>
'LARGE' then p.funding
when r.region = 'Northwest' then 'NWDA'
else 'COMM'
end as funding, pj.projectcode, pj.revisionnum
from project pj
join projectrule pr on pj.projectcode = pr.projectcode
join opportunity o on pr.opportunityid = o.opportunityid
join TMICustomerProspect c on o.customerorprospectid = c.customerid
left join TMIPostcodeFunding p on upper(REPLACE(p.postcode,' ',''))
= upper(REPLACE(c.postalcode,' ',''))
left join TMIRegion r on c.postalcode like r.postcode + ' %'
where pj.industrytypecode is null
) as c
where project.projectcode = c.projectcode and project.revisionnum =
c.revisionnum
and coalesce(project.industrytypecode, '') <> c.funding
Without using stored procedures or execute block?
Regards
Ian Newby