Hi All,
I've a two tables (new) and (Old) and like to compare the values the sql and output shown below
The output is like :
The desire output i would like to use as follow without Crosstab or INNER JOIN as there is not key field exist in the table?
Hope make sense
Thanks for your help
I've a two tables (new) and (Old) and like to compare the values the sql and output shown below
Code:
select 'TableA' , costcentre, count(costcentre) as Total Count, sum(values) as TotalAmt from TableA group by costcentre
UNION ALL
select 'TableB' , costcentre, count(costcentre) as TotalCount, sum(values) as TotalAmt from TableB group by costcentre
costcentre
The output is like :
TableName | Cost Centre | TotalCount |
TableA | 12345 | 100 |
TableB | 12345 | 110 |
The desire output i would like to use as follow without Crosstab or INNER JOIN as there is not key field exist in the table?
TableOld | TableNew | CostCentre | Old Table Count | New Table Count | Diff | Value Diff | |
TableA | TableB | 12345 | 100 | 110 | 10 | £9999 |
Hope make sense
Thanks for your help