SQL Server:Select A.ID, Sum(PatIndex('%小%',A.T1)*B.T1 + PatIndex('%小%',A.T2)*B.T2 + PatIndex('%小%',A.T3)*B.T3 + PatIndex('%小%',A.T4)*B.T4 + PatIndex('%小%',A.T5)*B.T5) AS 小, Sum(PatIndex('%中%',A.T1)*B.T1 + PatIndex('%中%',A.T2)*B.T2 + PatIndex('%中%',A.T3)*B.T3 + PatIndex('%中%',A.T4)*B.T4 + PatIndex('%中%',A.T5)*B.T5) AS 中, Sum(PatIndex('%大%',A.T1)*B.T1 + PatIndex('%大%',A.T2)*B.T2 + PatIndex('%大%',A.T3)*B.T3 + PatIndex('%大%',A.T4)*B.T4 + PatIndex('%大%',A.T5)*B.T5) AS 大From A, BWhere A.ID=B.IDGroup By A.ID---------------------Access:Select A.ID, Sum(IIf(A.T1='小',B.T1,0) +IIf(A.T2='小',B.T2,0) +IIf(A.T3='小',B.T3,0) +IIf(A.T4='小',B.T4,0) +IIf(A.T5='小',B.T5,0))as 小, Sum(IIf(A.T1='中',B.T1,0) +IIf(A.T2='中',B.T2,0) +IIf(A.T3='中',B.T3,0) +IIf(A.T4='中',B.T4,0) +IIf(A.T5='中',B.T5,0))as 中, Sum(IIf(A.T1='大',B.T1,0) +IIf(A.T2='大',B.T2,0) +IIf(A.T3='大',B.T3,0) +IIf(A.T4='大',B.T4,0) +IIf(A.T5='大',B.T5,0))as 大From A, BWhere A.ID=B.IDGroup By A.ID