I would like to ask to make a query like the following table?
------------------------------------- ID Date Input Output Total -------------------
Use SUM() OVER(..) window function which produce cumulative sum :
SUM() OVER(..)
SELECT t.id,t.date,t.input,t.output, SUM(t.output+t.input) OVER(PARTITION BY t.ID ORDER BY t.date) as Total FROM YourTable t