下面是显示数据的表格,这里我想要的是显示名称和保留类型作为单独的列,这可能吗?如果请指导
以下是grafana中用于以表格格式表示时间序列数据的格式。
SELECT il.DateFrom as time, // this is required for time series
il.NoOfDays,// for calculation of value
ie.FirstName +' '+ie.LastName +' ,'+' '+(( select name from IMS_LookupDetail where id=ic.TypeCode) ) as metric // for metric column
FROM IMS_LeaveManagement il JOIN
IMS_Employee ie
ON il.EmpId = ie.Id JOIN
IMS_LeaveConfiguration ic
ON ic.Id = il.LeaveConfigurationId JOIN
IMS_LookupDetail id
ON id.Id = ic.TypeCode or id.Code = ie.DepartmentCode
WHERE $__timeFilter(il.DateFrom) AND
il.Status in ('1','2') and id.name in ($dept)
在这里,我无法在表格中显示超过三列,想要的是将请假详细信息显示为单独的列,但在时间序列中我不知道该怎么做
答案 0 :(得分:1)
{{1}}
答案 1 :(得分:0)
如果员工姓名中出现的请假类型是固定且有限的,您可以直接执行此操作
SELECT REPLACE(
REPLACE(EMPLOYEE_NAME, ',Earned Leave', ''),
',Casual Leave', '') AS EMPLOYEE_NAME,
CASE WHEN EMPLOYEE_NAME LIKE '%Earned Leave%' THEN 'Earned Leave'
WHEN EMPLOYEE_NAME LIKE '%Casual Leave%' THEN 'Casual Leave'
ELSE 'Unknown Leave'
END AS LeaveType