Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update with count

Status
Not open for further replies.

sammybee

Programmer
Sep 24, 2003
103
GB
any ideas why I can't use this update statement?

update sb_void_offs
set offcount = blah
(Select pro_propref, count (oof_refno) blah
FROM sb_void_offs, organisation_offers
WHERE pro_refno = oof_pro_refno(+)
AND oof_offer_date BETWEEN voiddate AND letdate
group by pro_propref
)

cheers

Sam
 
Because it is incorrect -- try this:
Code:
update sb_void_offs v
   set offcount = (
       Select count (oof_refno)
         FROM organisation_offers o
        WHERE v.pro_refno = o.oof_pro_refno
          AND oof_offer_date BETWEEN voiddate AND letdate)
 where exists (          
       Select 1
         FROM organisation_offers o
        WHERE v.pro_refno = o.oof_pro_refno
          AND oof_offer_date BETWEEN voiddate AND letdate)

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Cheers All, this worked perfectly

p.s. love the proverb;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top