Home > database >  SQL statements numerical summary how to realize the next few lines added to the first line
SQL statements numerical summary how to realize the next few lines added to the first line

Time:09-26

Such as: the first line is 50, the second line is 100, 150, the third line finally become the first line 300, delete the two rows behind

CodePudding user response:

Is there a way to, you can use this over to implementation,
In the data line way to increase the aggregate column

If you want to return to the first row, only then add a new number row_number as inside, outside parcel a select again... From where the new number=1

CodePudding user response:

Select sum (colName) from tblName/line/summary
Union all
Select colName from tblName//raw data, oneself see add a where clause

CodePudding user response:

Such as: the first line is 50, the second line is 100, 150, the third line finally become the first line 300, remove two rows behind
--> Per three lines is rules, please do the summary? Such as line 1-3, 4-6, 7-9 line... Summary.
  • Related