Skip to content
Advertisement

Tag: pivot

Set two decimal places after AVG function inside PIVOT

The output keeps being 95.000000 I tried using AVG( CAST(Grades AS Decimal(10,2) ) ) inside the pivot, and it keeps returning a syntax error about (. Tried using CAST AS DECIMAL inside the FROM subquery, but it just keeps putting the same 00000 output. CAST AS FLOAT works but I need two decimal places and it eliminates trailing 0s Using

TSQL PIVOT/UNPIVOT Multiple Summarized Columns

Seems this is a popular topic but I can’t seem to replicate other answers. I have data that is already summarized by month/year for multiple categories. What I’m trying to get is this Here’s the query to provide the data I’ve used PIVOT a bunch of times, but with a single “category” of data. I can’t seem to get anything

How sum values in days intervals MySQL 5.7?

I have a server with MySQL 5.7. I have two tables. First one t contains creating dates for each id. Second table t0 contains profit records day by day for each id. I want to get columns with sums of profit for first and second 30 days for each id as well as for the first day. This code runs

How do a pivot on sql server on one column but renamed dynamics column

I’ve a table of prices With Reference, Price Category (Ex professional/Customer…) , the weight and the price Each article have X lines for same Reference, Price Category depend of weight I Want a return with Reference, Price Category, Price1,Price2… I try to adapt codes I’ve found but I’ve a problem to linked weight and named columns PRIX1,PRIX2… I don’t want

Advertisement