lestermadoc
Programmer
I have a one to many relationship between "cases" and "casenotes". Wherever there is a "flagger = true" in "casenotes" I want to mark the record in "cases" as "true" in the "manflag" field.
The problem with my code is that if there is only one "flagger=true" in one of the "casenotes" records, then it marks every single "cases" record as "manflag=true". My code is listed below.
cnn.Execute ("Update cases SET cases.manflag = 'true' FROM cases, casenotes WHERE cases.caid = casenotes.caid and (select count (*) from cases, casenotes where cases.caid = casenotes.caid and casenotes.flagger = 'true') > 0"
The problem with my code is that if there is only one "flagger=true" in one of the "casenotes" records, then it marks every single "cases" record as "manflag=true". My code is listed below.
cnn.Execute ("Update cases SET cases.manflag = 'true' FROM cases, casenotes WHERE cases.caid = casenotes.caid and (select count (*) from cases, casenotes where cases.caid = casenotes.caid and casenotes.flagger = 'true') > 0"