sql提升

SELECT
*
FROM
s_contant a
WHERE
a.class_id = ANY (
SELECT
id
FROM
s_class
WHERE
s_class.parent = 4

)

【sql中连接字符串】

concat('%',#{name},'%')

【根据id相同的拼接字符串 】 GROUP_CONCAT(id)

SELECT office_id,GROUP_CONCAT(id) FROM 
(SELECT
*
FROM
sys_user
WHERE
office_id IN (1, 2, 6)
OR id IN (17, 18, 19, 25)) AS a GROUP BY office_id

你可能感兴趣的:(sql提升)