如何把mysql查询结果赋值给多个变量

2024-12-21 23:37:53
推荐回答(1个)
回答1:

DECLARE PRIMARY_KEY VARCHAR(100);
SET PRIMARY_KEY = group_concat(NEW.USER_ID,NEW.ROLE_NAME);
查询语句是这样写的:
select group_concat(NEW.USER_ID,NEW.ROLE_NAME)from NEW where 条件;
SELECT group_concat(NEW.USER_ID,NEW.ROLE_NAME separator '连接字符') FROM NEW where 条件;