I have a table of three numbers that are the percent difference of other numbers.
The query I've used looks like this:
select abs((((select avg(Number) from Table1 where File='File1') -
(select avg(Number) from Table1 where File='File2')) /
(select avg(Number) from Table1 where File='File2'))*100)
union all
select abs((((select avg(Number) from Table1 where File='File3') -
(select avg(Number) from Table1 where File='File4')) /
(select avg(Number) from Table1 where File='File4'))*100)
union all
select abs((((select avg(Number) from Table1 where File='File5') -
(select avg(Number) from Table1 where File='File6')) /
(select avg(Number) from Table1 where File='File6'))*100)
which results in a table like this:
| (No column name) |
|:----------------:|
| 1.54 |
| 1.15 |
| 2.04 |
These numbers are the percent difference for a category of data from three files. These file names are Column1 in Table1. How could I write this query so that the table looks like this instead? (Add the file names in a column to the left of these numbers).
| FileName | (No column name) |
|:--------:|:----------------:|
| File1 | 1.54 |
| File2 | 1.15 |
| File3 | 2.04 |