Run Code  | API  | Code Wall  | Misc  | Feedback  | Login  | Theme  | Privacy  | Patreon 

SQL Server query that add a column in a Select Query

Language: Layout:
View schema
Execution time: 0,02 sec, rows selected: 9, rows affected: 10, absolute service time: 0,16 sec 
edit mode |  history
   CodeGenerated
1 select NU_CONS_SOSA_SOSE, [CD_CODI_SER_SOSE_1],[CD_CODI_SER_SOSE_2],[CD_CODI_SER_SOSE_3] from ( select NU_CONS_SOSA_SOSE , CD_CODI_SER_SOSE , rn='CD_CODI_SER_SOSE_'+convert(nvarchar(10),row_number() over ( partition by NU_CONS_SOSA_SOSE order by CD_CODI_SER_SOSE )) from CX_SOLICITUD_SERVICIO ) as a pivot (max([CD_CODI_SER_SOSE]) for [rn] in ([CD_CODI_SER_SOSE_1],[CD_CODI_SER_SOSE_2],[CD_CODI_SER_SOSE_3]) ) p
   NU_CONS_SOSA_SOSE CD_CODI_SER_SOSE_1 CD_CODI_SER_SOSE_2 CD_CODI_SER_SOSE_3
1 756 i132300 NULL NULL
2 758 i132300 NULL NULL
3 761 i132300 i132301 NULL
4 763 i132300 NULL NULL
5 777 i595101 i684000 i705210
6 778 i549201 i684000 NULL

    
                
λ
.NET NoSQL database for rapid development