mysql字段合并,if用法,left right用法

select id,userid,ydr,cs,ty,sp,roomid,s_time,e_time,conftitle,roomid as resourceId,CONCAT_WS(',', username,conftitle,CONCAT_WS('-',right(s_time,5),right(e_time,5)),CONCAT_WS('',if(cs=1,'茶水',''),if(ty=1,'投影',''),if(sp=1,'视频',''))) as title,s_time as start,e_time as end from roomorder where s_time>=? and e_time<?

推荐一篇:https://www.cnblogs.com/-tang/p/13782826.html