Postgresql Create Table From Query Sql Running Balance