Questions tagged as 'pivot'

2
answers

Convert row to column

I have a field called "Shift" of type STRING , storing data in MySql like this: '1,2,3,4,5,6,7,8,9' I need this string to transpose (transpose) into a single column (in this case, it would be the inverse of what GROUP_CONCAT...
asked by 04.03.2014 / 05:54
2
answers

I can not put a subquery inside the IN in PIVOT

Below is the code for creating the table and inserting some data for testing. CREATE TABLE [dbo].[tb_empresas]( [data] [date] NULL, [nome] [varchar](100) NULL, [valor] [decimal](18, 2) NULL ) ON [PRIMARY] INSERT INTO tb_empresas (data, nome,...
asked by 10.03.2014 / 15:29
2
answers

Place data from a row in columns

SELECT datacc, horacc FROM R070ACC WITH (NOLOCK) WHERE numcad = '2676' AND DATACC between ('2018-16-04') and ('2018-15-05') and oriacc = 'E' In the first column appears the day of the month repeated 4x, with different records in the sec...
asked by 16.06.2018 / 17:27
2
answers

Using the PIVOT operator without aggregation

I have the FAULTS table with the following columns: CREATE TABLE [dbo].[FALTAS]( [Id] [int] IDENTITY(1,1) NOT NULL, [Matricula] [int] NOT NULL, [Dia] [date] NOT NULL, [Situacao] [varchar](50) NOT NULL, CONSTRAINT [PK_FALTAS] PRIMARY KEY CLUSTE...
asked by 21.06.2014 / 19:19
1
answer

Conversion and grouping of rows in columns dynamically in Oracle

Context:    I have a Project with several Versions of applications that will be   developed, each Version several Requirement of New Functions   (NF), each NF with several Codes changes in various Repositories.   In addition, these NFs...
asked by 18.12.2015 / 21:08
1
answer

How do I use today's date as column heading in MySQL

I have the following table: Consideringthattodayis02/01/2019,whenmakingthepivottablebelow:SELECThora,CASEWHENdata=CURDATE()THENtarefaELSENULLENDAScampo_1FROMtabelaWHEREdataBETWEENCURDATE()ANDDATE_ADD(CURDATE(),INTERVAL2DAY)GROUPBYhora,dataOR...
asked by 03.01.2019 / 20:42
1
answer

Transform rows into a select column - PIVOT - SQL Server

I have a SQL query that returns the following result: Inquiry +--------------------------------------------------------------------------+ | CONJUNTO | TIPO | FILHO | PAI | TIPO_CONTEUDO | TIPO_DESCRICAO | +---...
asked by 21.09.2017 / 22:32
2
answers

Arrange columns in rows for equal IDs in SQL server

I have a single table with some foreign key records repeated a maximum of 5 times according to entries, eg: id_ok|fornecedor|valor_final|escolha|ativo| -------------------------------------------- o_11 | DOPE |R$ 20800 | SIM | NOK | o_...
asked by 04.12.2015 / 15:48
2
answers

Add rows with the same ID in additional columns

I have the following table scenario: +-------------------------------------------------------------+ | ID | DATA | PROFISSAO | SEQUENCIA | +-------| --------------|-----------------------|-------------+ | 1 | 2018...
asked by 22.05.2018 / 22:32
1
answer

USING PIVOT ORACLE

I have this result:    Ana DEC 123 7 2016 1GG       Ana DEC 123 3 2016 1GG       Ana DEC 123 3 2016 1GG       Ana JCM 123 5 2017 1GG       Edson DES 123 11 2016 1GG       Edson DES 123 3 2017 1GG I'm using this PLSQL: SELECT *...
asked by 28.07.2017 / 17:12