SELECT
(
SELECT
count(1)
FROM
t_app_user
WHERE
parent_user_id = t.user_id /*多层级,t.user_id */
) AS directCount,
getSubUserCount (user_id) AS subUserCount,
(
SELECT
count(1)
FROM
t_card_inf
WHERE
user_id = t.user_id
AND STATUS = 0
) AS cardNum,
t.*
FROM
t_app_user t
ORDER BY
t.row_crt_ts DESC