February 3, 2005 at 1:57 pm
Hi experts,
Is there any way to add a output column (say column name = 'Diff') which compares epay.EmployID and epay.Socscnum, and show 'Y' if these 2 columns are not the same on this 'Diff' column?
Thanks.
----------------------------------------------------------------
select upr.LASTNAME+upr.FRSTNAME as EmployeeName,epay.EmployID, epay.Socscnum, epay.Funding_Ind as Status
from Epay_Fund_Transaction_Table epay left outer join UPR00100 upr on upr.employid=epay.employid
February 3, 2005 at 2:09 pm
See BOL on CASE .. WHEN
select upr.LASTNAME+upr.FRSTNAME as EmployeeName
epay.EmployID,
epay.Socscnum,
epay.Funding_Ind as Status,
Case
When epay.EmployID = epay.Socscnum Then 'N'
Else 'Y'
End As Diff
from Epay_Fund_Transaction_Table epay
left outer join UPR00100 upr on upr.employid=epay.employid
You didn't specify what is required if both are Null, which may impact the solution.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply