SET @PERIOD_NUM = 131;

SELECT
    P.USER_ID,
    U.USER_NAME,
    P.SURPLUS_1L `期业绩一市场结余`,
    UP.SURPLUS_1L `结余业绩业绩一市场结余`,
    IF(P.SURPLUS_1L=UP.SURPLUS_1L,'TRUE','FALSE') `期业绩一市场结余与结余业绩业绩一市场结余是否相等`,
    P.SURPLUS_2L `期业绩二市场结余`,
    UP.SURPLUS_2L `结余业绩业绩二市场结余`,
    IF(P.SURPLUS_2L=UP.SURPLUS_2L,'TRUE','FALSE') `期业绩二市场结余与结余业绩业绩二市场结余是否相等`,
    P.SURPLUS_3L `期业绩三市场结余`,
    UP.SURPLUS_3L `结余业绩业绩三市场结余`,
    IF(P.SURPLUS_3L=UP.SURPLUS_3L,'TRUE','FALSE') `期业绩三市场结余与结余业绩业绩三市场结余是否相等`
FROM
    AR_PERF_PERIOD P
    LEFT JOIN AR_USER U ON U.ID = P.USER_ID
    LEFT JOIN AR_USER_PERF UP ON UP.USER_ID = P.USER_ID
    WHERE P.PERIOD_NUM = @PERIOD_NUM