sql字段值转字段
表alertlabel
中记录变字段
如何用alertlabel
表得到下面数据
实现的sql语句
select a.AlertID,
(select Value from alertlabel where AlertID=a.AlertID and Label='host') as host,
(select Value from alertlabel where AlertID=a.AlertID and Label='job') as job
from (select AlertID from alertlabel group by AlertID) a;
参考
- sql表记录值变成字段:https://blog.csdn.net/tx_yu/article/details/4805171