Help with update query
Posted on 2007-10-03
SQL Server 2000.
I have the following query which runs fine:
SET API__bNumber = t2."EMP ID", [Has__bAPI__bMatch__bRun__Q]='Yes'
FROM MASTER55 t1
JOIN [API].LaborWorkx_Live.dbo.vwCGHS_All_EmpList t2
ON t1.SSN = right(t2.SSN, len(t2.SSN) - 1)
AND t1.L__d__bName = t2."Last Name"
AND t1.F__d__bName = t2."First Name"
AND t1.mrREF_TO_MR Is null
AND API__bNUMBER Is null
AND [Has__bAPI__bMatch__bRun__Q] Is null
However, I need to change it to achieve the following. I need the field [Has__bAPI__bMatch__bRun__Q] to be set to Yes regardless of whether a successful match is made between the EMP ID and API__bNumber. This [Has__bAPI__bMatch__bRun__Q] field will be used to tell whether or not the query has ran for that particular record, so it needs to be set to Yes each time the query runs, whether its successful or not in finding a match. Please advise. Thanks.