Question : SQL--Subtract two fields to get new field

I am trying to see with SQL where there is a difference between 2 officers (these are set as numbers) so in the past in other programs I have subtracted the numbers and if it is not a 0 then I show it but I am now using SQL for my reports and I cant figure out how to do it. Below is my Select statement, I am trying to see where Current Officer is different from Current Officer.Let me know if I need to provide more information.
Code Snippet:
1:
2:
3:
4:
5:
6:
SELECT     dbo.FDM.[As of Date], FDM_1.[As of Date] AS Expr1, dbo.FDM.[Primary Officer Code] AS [Historical Officer], 
                      FDM_1.[Primary Officer Code] AS [Current Officer], dbo.FDM.[Bank Share Balance (Account)*] AS [Historical Balance], 
                      dbo.FDM.[GL MTD Avg Current Balance (Account)*] AS [Historical Avg Current Balance], 
                      dbo.FDM.[GL MTD Avg Bank Share Balance (Account)*] AS [Historical Avg Bank Share Balance], 
                      FDM_1.[Bank Share Balance (Account)*] AS [Current Bank Share Balance], FDM_1.[GL MTD Avg Current Balance (Account)*] AS [Current Avg Balance], 
                      FDM_1.[GL MTD Avg Bank Share Balance (Account)*] AS [Current Avg Bank Share Balance]
Open in New Window Select All

Answer : SQL--Subtract two fields to get new field

SELECT    
dbo.FDM.[As of Date], FDM_1.[As of Date] AS Expr1,
dbo.FDM.[Primary Officer Code] AS [Historical Officer],
  FDM_1.[Primary Officer Code] AS [Current Officer],
 
 
dbo.FDM.[Bank Share Balance (Account)*] AS [Historical Balance],
dbo.FDM.[GL MTD Avg Current Balance (Account)*] AS [Historical Avg Current Balance],
dbo.FDM.[GL MTD Avg Bank Share Balance (Account)*] AS [Historical Avg Bank Share Balance],
 
FDM_1.[Bank Share Balance (Account)*] AS [Current Bank Share Balance],
FDM_1.[GL MTD Avg Current Balance (Account)*] AS [Current Avg Balance],
FDM_1.[GL MTD Avg Bank Share Balance (Account)*] AS [Current Avg Bank Share Balance]

from some code here ---


where FDM.[Primary Officer Code] <>  FDM_1.[Primary Officer Code]


if not then please post all you script...
Random Solutions  
 
programming4us programming4us