I would like a pure SQL query to do the following:
I have a table that has an unknown set of records created at runtime (this data set changes all the time).
Lets assume I have 100 rows and 3 columns
Column1 is an integer value with data from 1 to 100 (sequentially)
Column 2 is some number that is consistant for all records except the very last record.
Column 3 is a number that is diffrent for each record.
I would like to combine each consequtive 12 rows into a single row and then the three columns should be
Column 1 should then be sequential from 1 to 9 (ie: 100/12=8.3)
Column 2 should be the sum of column 2 of the 12 rows
Column 3 should be the sum of column 3 of the 12 rows
I am currently doing this with a function and saving the results into a temp table.
I would like to know if there is an SQL way of doing this without changing the existing data or creating a new temp table (ie: a select statement is needed)
One more caveat - This database is using SQLite so I need pure SQL and not something specific to Access. I posted here because I did not see an SQLite section.
cheers,
I have a table that has an unknown set of records created at runtime (this data set changes all the time).
Lets assume I have 100 rows and 3 columns
Column1 is an integer value with data from 1 to 100 (sequentially)
Column 2 is some number that is consistant for all records except the very last record.
Column 3 is a number that is diffrent for each record.
I would like to combine each consequtive 12 rows into a single row and then the three columns should be
Column 1 should then be sequential from 1 to 9 (ie: 100/12=8.3)
Column 2 should be the sum of column 2 of the 12 rows
Column 3 should be the sum of column 3 of the 12 rows
I am currently doing this with a function and saving the results into a temp table.
I would like to know if there is an SQL way of doing this without changing the existing data or creating a new temp table (ie: a select statement is needed)
One more caveat - This database is using SQLite so I need pure SQL and not something specific to Access. I posted here because I did not see an SQLite section.
cheers,
Comment