![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I want to use an aggregate function (Count) to set a field value in an Update statement. I get an error that states this is not allowed. I could do the aggregation in a view and then update the field value based on the view, but is there a better? Following is what I want to do: UPDATE PCP_Measures SET Med_Claim_Memb_Cnt = COUNT(DISTINCT CLAIM_MASTERS.MEMBID) FROM CLAIM_MASTERS WHERE CLAIM_MASTERS.PCP = PCP_Measures.PCP AND CLAIM_MASTERS.LOB = PCP_Measures.LOB GROUP BY CLAIM_MASTERS.PCP, CLAIM_MASTERS.LOB |
#3
| |||
| |||
|
|
Robert, UPDATE PCP_Measures SET Med_Claim_Memb_Cnt = (SELECT COUNT(DISTINCT CLAIM_MASTERS.MEMBID) FROM CLAIM_MASTERS WHERE CLAIM_MASTERS.PCP = PCP_Measures.PCP AND CLAIM_MASTERS.LOB = PCP_Measures.LOB ) Ilya "Robert Hamilton" <RobertHamilton (AT) discussions (DOT) microsoft.com> wrote in message news:371AE6A1-BA7B-41A7-A93D-D726EE12E0DE (AT) microsoft (DOT) com... I want to use an aggregate function (Count) to set a field value in an Update statement. I get an error that states this is not allowed. I could do the aggregation in a view and then update the field value based on the view, but is there a better? Following is what I want to do: UPDATE PCP_Measures SET Med_Claim_Memb_Cnt = COUNT(DISTINCT CLAIM_MASTERS.MEMBID) FROM CLAIM_MASTERS WHERE CLAIM_MASTERS.PCP = PCP_Measures.PCP AND CLAIM_MASTERS.LOB = PCP_Measures.LOB GROUP BY CLAIM_MASTERS.PCP, CLAIM_MASTERS.LOB |
#4
| |||
| |||
|
|
Robert, UPDATE PCP_Measures SET Med_Claim_Memb_Cnt = (SELECT COUNT(DISTINCT CLAIM_MASTERS.MEMBID) FROM CLAIM_MASTERS WHERE CLAIM_MASTERS.PCP = PCP_Measures.PCP AND CLAIM_MASTERS.LOB = PCP_Measures.LOB ) Ilya "Robert Hamilton" <RobertHamilton (AT) discussions (DOT) microsoft.com> wrote in message news:371AE6A1-BA7B-41A7-A93D-D726EE12E0DE (AT) microsoft (DOT) com... I want to use an aggregate function (Count) to set a field value in an Update statement. I get an error that states this is not allowed. I could do the aggregation in a view and then update the field value based on the view, but is there a better? Following is what I want to do: UPDATE PCP_Measures SET Med_Claim_Memb_Cnt = COUNT(DISTINCT CLAIM_MASTERS.MEMBID) FROM CLAIM_MASTERS WHERE CLAIM_MASTERS.PCP = PCP_Measures.PCP AND CLAIM_MASTERS.LOB = PCP_Measures.LOB GROUP BY CLAIM_MASTERS.PCP, CLAIM_MASTERS.LOB |
![]() |
| Thread Tools | |
| Display Modes | |
| |