Posts by Caio César Henrique • 55 points
5 posts
-
1
votes1
answer1253
viewsQ: PIVOT 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…
-
0
votes3
answers717
viewsA: SQL - Return zeroed records
With the help of a colleague, we come to this end: SELECT Substring(C5_EMISSAO, 1, 6) AS EMISSAO, Sum(C6_QTDVEN - C6_QTDENT) AS PERDA INTO #TEMP1 FROM SC5010 SC5 WITH (NOLOCK) INNER JOIN SC6010 SC6…
-
3
votes3
answers717
viewsQ: SQL - Return zeroed records
Good morning, I have a query that is only returning the months with sales consumption, which should be correct. Only now a blessed user wants me to return every month, including those who have no…
-
1
votes1
answer224
viewsA: Total SQL Records in all columns
I figured it out. I switched ROW_NUMBER to @@ROWCOUNT, solved
-
0
votes1
answer224
viewsQ: Total SQL Records in all columns
I need to return the total query records in a column, even repeated, like this: However, the query is kind of boring. A query of 106 lines, with several SUM() and with a mandatory ORDER BY. I cannot…