Home > database >  How to write great god wouldn o the SQL statements
How to write great god wouldn o the SQL statements

Time:09-25

CodePudding user response:

SQL is very simple, built the table statements and insert test data posted,

CodePudding user response:

With temp as
(

Select * from total table group by classification field
)

Select
The sum (case when t.d ate=to_date (to_char (date of January, 'the date date format),' the date date format) then statistical fields else 0 end) as January,
.

The from temp t
The union
Select
"' the as number,
The sum...
The sum...
The from temp t
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Almost like this
  • Related