sql select查询动态添加列,标识列
1. 使用单引号, 默认值(标识列)
select 'good' as "ELable", "DGHashId" as "EHashId", "DHashId" as "DHashId", "PHashId" as "PHashId", "DSNames" as "EContent", "DGDiagnosisTime" as "EDateTime", "DGStatus" as "EStatus", "DGUpdateTime" as "ECreateTime" from "Diagnosis" where "DHashId" ='4444444444444444' and "PHashId" = 'c61b362b1c9dcd09' and "DGStatus" = 1
效果图如下:
1. 使用ROW_NUMBER() ;(优点,主要用排序功能)
select row_number() over(order by "DHashId") as "ELable", "DGHashId" as "EHashId", "DHashId" as "DHashId", "PHashId" as "PHashId", "DSNames" as "EContent", "DGDiagnosisTime" as "EDateTime", "DGStatus" as "EStatus", "DGUpdateTime" as "ECreateTime" from "Diagnosis" where "DHashId" ='4444444444444444' and "PHashId" = 'c61b362b1c9dcd09' and "DGStatus" = 1
效果如下图:
本文来自博客园踩坑狭,作者:韩若明瞳,转载请注明原文链接:https://www.cnblogs.com/han-guang-xue/p/11759450.html