Most voted "pivot" questions
38 questions
Sort by count of
-
9
votes2
answers5943
viewsConvert row to column
I have a field called "Shift" kind STRING, storing data in Mysql in this way: '1,2,3,4,5,6,7,8,9' I need this string line to transform (transpose) into a single column (in this case, it would be the…
-
6
votes2
answers652
viewsI cannot place a subquery inside the IN in the PIVOT
Below is the code for table creation and insertion of some data for test. CREATE TABLE [dbo].[tb_empresas]( [data] [date] NULL, [nome] [varchar](100) NULL, [valor] [decimal](18, 2) NULL ) ON…
-
5
votes1
answer3762
viewsPIVOT - Group Duplicate Records in a Single Line
I have a problem with a query, in which I need to turn rows into columns. In case I thought to use the function pivot, but it didn’t work very well, since mysql doesn’t provide me with such a…
-
5
votes2
answers121
viewsPlace row data 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…
-
4
votes2
answers1970
viewsUse 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…
-
3
votes1
answer269
viewsPIVOT - SELECT reversing row and column
I have a table like this: codigo ano quant 100 2014 15 100 2015 13 100 2016 20 101 2015 15 102 2016 22 102 2014 05 I want to create a query that lists me the code like this: codigo 2014 2015 2016…
-
3
votes1
answer7165
viewsConversion and Grouping of Rows into columns dynamically in Oracle
Context: I have a Project mixed Versions of apps that will be developed, each various Version New Feature Requirement (NF) means each NF with several Code changes in several Repositories. In…
-
3
votes1
answer3146
viewsTurn rows into a select column - PIVOT - SQL Server
I have an SQL query that returns the following result: Consultation +--------------------------------------------------------------------------+ | CONJUNTO | TIPO | FILHO | PAI | TIPO_CONTEUDO |…
-
3
votes1
answer36
viewsHow do I use today’s date as column title in Mysql
I have the following table: Whereas today is 02/01/2019, while doing the pivot table below: SELECT hora, CASE WHEN data = CURDATE() THEN tarefa ELSE NULL END AS campo_1 FROM tabela WHERE data…
-
2
votes2
answers531
viewsOrganize columns in rows for equal ID in SQL server
I have a single table with some key records(Foreign key) repeated at most 5 times according to entries, example: id_ok|fornecedor|valor_final|escolha|ativo|…
-
2
votes1
answer705
viewsHow to join the two tables in this case?
I have two tables a "students" with the enrollment and enrollment and another "faz_teste" with the grades of the students in certain tests. I used the pivot command in the table "faz_teste" to…
-
2
votes1
answer248
viewsUSING PIVOT ORACLE
I have that 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 * FROM…
-
2
votes2
answers22
viewsDoubts with PIVOT on Oracle
Good afternoon, I’m having trouble setting up a Pivot on the Oracle. My query returns the categories in general, so I’m using the pivot to count the number of categories. pivot( count(CAT) for CAT…
-
2
votes2
answers85
viewsAdd rows with the same ID in additional columns
I have the following Table scenario: +-------------------------------------------------------------+ | ID | DATA | PROFISSAO | SEQUENCIA | +-------|…
-
1
votes0
answers85
viewsPIVOT Help - SELECT SQL
I have a table with the data: unidade tipo valor 1 2 10,00 1 3 15,00 2 2 16,00 3 3 10,00 3 1 25,00 I need to make a select with pivot that brings me unidade tipo1 tipo2 tipo3 1 0,00 10,00 15,00 2…
-
1
votes0
answers40
viewsPivottablewizard() "Connection" parameter
Hello, could someone provide me an example of using the appropriate parameter connection of the method PivotTableWizard()? When I use this parameter I get the error: Unable to obtain the…
-
1
votes1
answer375
viewsCalculate average with Pivot result
I have a query that returns the grades of students in certain tests. The amount of test may vary. I use the Pivot command to transform test names into columns and so organize test/note, as shown in…
-
1
votes1
answer377
viewsFilter dynamic table (Power Pivot) by Listbox
This code: /a/309087/116347 Make the selection in Listabox ... and Filter activated by a button.. as described in the link... But if the Dynamic Table is created by Power Pivot .. This code does not…
-
1
votes1
answer1253
viewsPIVOT SQL - Dynamic Columns with Variable
I have a table which I turn rows into columns with PIVOT. 'Chumbando' the name of the columns, works very well, however I will need to do this dynamically. There is the possibility to use variables…
-
1
votes2
answers458
viewsSum in a Pivot Table
I’m learning how to use tables with PIVOT in Sql-Server. I have a table with the item name, seller name and customer id. Item | Customer | ID Rep Pen Set | 1001 | Richard Binder | 25092 | Nick Pen…
-
1
votes1
answer182
viewsSelect with PIVOT always returns null
I’m trying to do a query using the pivot based on this link insert link description here, but without success, as it always returns 2 Null lines: Query: DECLARE @registros as table ( ID int, Campo…
-
1
votes0
answers33
viewsOracle Pivot returning more than one line
all right, guys? I have a problem here. I have the code below: SELECT /*+parallel(12)+*/ DES_REGIS, DES_CONTR, COMPRAS_OFFUS_PARC_COM_JUROS, COMPRAS_OFFUS_PARC_SEM_JUROS, COMPRAS_OFFUS_AVISTA,…
-
1
votes0
answers45
viewsError in SQL SERVER PIVOT
Guys, I have a problem in the structure of my PIVOT. DECLARE @IdGiaContribuinte INT = 0, @IdGrupoContribuinte INT = 0, @Exercicio INT = 2017, @IdVafvalorAdicionadoTipo INT = 3 SELECT U.Exercicio,…
-
1
votes1
answer144
viewsAdditional Fields in Pivot Model Laravel 6?
I’m in my first Laravel Framework project and I’m having difficulty in relationship N:M, I have the database structure fornecedor->fornecedor_produto->produto** have my models: class…
-
0
votes2
answers1948
viewsSQL - set null values to 0
I have a table pivot that returns some null values in SUM(1). I wish they were zero instead of zero, but I’m not getting it. Pivot table original SELECT Description AS Categoria, [ACS], [URO] FROM (…
-
0
votes1
answer62
viewsDetermining value within a pivot
I have a query in which you are making a pivot and she’s bringing in the correct records per month, but I’d like to validate the amount of records per month that show only employees who have >=…
-
0
votes0
answers31
viewsUpdate all dynamics in a spreadsheet - error
I got this code in a question here, to update the dynamics of a spreadsheet, but when running the macro, it presents error - pt.RefreshTable. Run-time error '1004': Reference isn’t Valid.…
pivotasked 6 years, 6 months ago Lucas Daros 19 -
0
votes0
answers39
viewsMysql - What would be the pure sql query that would be equivalent to Laravel Sync in a pivot table?
When I work with Laravel in a pivot table where we have only the fields user_id and post_id we use something similar to $user->posts()->sync([3,4]) and the pivot table will be updated with…
-
0
votes0
answers13
viewsIt is possible to pivot with varied values to turn into column - SQL
Hello! I am studying sql, and I am doubtful, I am with a sample bank, and I have the following situation, I have a product code, and an Ean code in products, for Ean code it repeats the product…
-
0
votes1
answer106
viewsRow results in columns ( SUM )
Good Afternoon, I have a big question in my query, I have a table with the following info: I would like the following result I need the result to be the total value of (forms of payments) per day,…
-
0
votes1
answer14
viewspivot_table of frequency
I want to build a pivot_table on pandas that counts frequency. For example, I have a sex column, with 2 options, one of UF, with 5 options, and one of color, with 4 options, I wanted to make a table…
-
0
votes2
answers130
viewsHow do I Group Text in Mysql
I’ve tried to find a solution to this case, and I need your help. I have the following table: hora data tarefa 10:00 02/01/19 A 10:00 03/01/19 B 11:00 02/01/19 C Whereas today is 02/01/2019, while…
-
0
votes1
answer109
viewsPIVOT after execution the message is "Incorrect syntax next to the keyword 'FOR'."
I need my data to return customer information by courses in a single row, that is, the various different courses done instead of coming in individual rows need to appear in new columns in the…
-
0
votes2
answers79
viewsPivot with Temporary Table
Hello. I am building a query where I need to use pivot to analyze the results, but it does not return the necessary data. Original table: select * from tbCampoAdicionalTicket where TCK_SEQUENCIAL =…
-
0
votes1
answer41
viewsTurn row into columns using pivot
I have this list that is the result of the query below: This is the query: SELECT PERIODO, ST_NOME_SUPERVISOR, Sum (NU_TOTAL_VENDA) AS NU_TOTAL_VENDA FROM ( SELECT UPAI.ST_NOME AS…
-
0
votes1
answer36
viewsPivot Room Sqlite
Good night, you guys. I am using select below, but I would like the turns to be columns. As there is no pivot option, how can I do this? select tma.turma as TURMAS, tno.turno as TURNOS, count…
-
-1
votes2
answers687
viewsTOTAL row with the SUM of columns using PIVOT
Is it possible to do a row of TOTALS per column? The explanation of totals per row was fantastic and it turned out beautiful in my project. Thank you. My code: SELECT ano AS Ano, CCUSTOS AS [Centro…
-
-2
votes0
answers18
viewsExcel Help || POWER PIVOT
I am trying to learn how to use power pivot in conjunction with power query for obtaining and modeling data in excel. I was able to import the databases and include them in the excel data model,…