先筛选再连接
SELECT
d.NAME,
v.phone
FROM
( SELECT d.* FROM tablea d LIMIT #{currIndex} , #{pageSize}
) AS d
LEFT JOIN tableb v ON v.user_id = d.user_id
WHERE
v.del_flag = '0'
ORDER BY
d.add_time DESC
2023-12-17 11:06:27
SELECT
d.NAME,
v.phone
FROM
( SELECT d.* FROM tablea d LIMIT #{currIndex} , #{pageSize}
) AS d
LEFT JOIN tableb v ON v.user_id = d.user_id
WHERE
v.del_flag = '0'
ORDER BY
d.add_time DESC
下一篇:SQL语句大全