I have input data and output data after adding Running total tool in the screenshots attached.
But When I have done like in Sql using Window function
Based on the images you shared the Alteryx output can match your SQL output by Sorting on id1, id2. With AMP Engine turned on, data is batched to speed up processing, which is done in a deterministic way, but will mess up the sort ordering. Alternatively, you can add a [RecordID] column prior to Running Total and then Sort on [RecordID] afterward.