题解 | #每个用户的第一有效信息#
每个用户的第一有效信息
https://www.nowcoder.com/practice/4408f866778b44c5bcebf17c386d7d13
select device_id, (case when answer_cnt is not null Then concat('答题数:',answer_cnt) when answer_cnt is null and gpa is not null Then concat('gpa:',gpa) when answer_cnt is null and gpa is null and age is not null Then concat('年龄:',age) else '暂无关键信息' End) as key_info from user_profile order by device_id asc
case when 后面可以用and链接多个条件