(case when length(p.name)>25 then concat(substring(p.name,1,12),'...') else p.name end) as projectName

SELECT DISTINCT
pw.project_id as projectId ,
(case when length(p.name)>25 then concat(substring(p.name,1,12),'...') else p.name end) as projectName
FROM project_warning pw
join warning_detail wd on pw.id = wd.warning_id
join project p on p.id = pw.project_id
join department d on d.dept_no = p.deparmtent_id
where d.dept_name like concat('信息平台事业部-',ifnull(
(select reverse(substring_index(reverse(substring_index((select dept_name from department where dept_no=:deptNo), '-', 2)), '-', 1)))
,''),'%')
and date(pw.create_date) = date(now())
order by pw.id asc limit 5

你可能感兴趣的:((case when length(p.name)>25 then concat(substring(p.name,1,12),'...') else p.name end) as projectName)