For help how to set up can be arranged, so the use of SQL statements for the first time, can only make one, using FastReport can be set to this before
CodePudding user response:
- build table
The CREATE TABLE # T
(
Department name VARCHAR (100),
The value of the INT
)
- insert the data
INSERT INTO # T VALUES (' ultrasound, 100), (' pediatrics, 200), (' brain ', 300), (' emergency ', 200), (' 'hospital, 300), (' new', 350), (210) 'logistics',
Query -
; WITH ct
AS
(
SELECT *,
(ROW_NUMBER () OVER (ORDER BY GETDATE ()) + 1)/2 AS I,
(ROW_NUMBER () OVER (ORDER BY GETDATE ()) + 1) % 2 AS the FROM j # T
),
Ct2 AS
(
SELECT * FROM ct
The UNION
SELECT the 'summary', the SUM (amount), 9999999, j FROM ct GROUP BY ct. J
)
Amount, department name, SELECT a. a. b. department name, b. amount FROM
(SELECT * FROM ct2 WHERE j=0) A LEFT JOIN
(SELECT * FROM ct2 WHERE j=1) B ON B.i=Anderson,
The ORDER BY Anderson,
CodePudding user response:
This is not a SQL statement, it is on the SQL SERVER Reporting statements made