I have the two following UPDATE Request :
UPDATE TableName
SET Sector = 'NameSector'
WHERE Sector IN('') AND ThType IN ('Test2')
UPDATE TableName
SET Sector = 'NameSector1'
WHERE Sector IN('') AND ThType IN ('Test1');
How can I Merge it ?
Note : This Answer does not work on ACCESS
CodePudding user response:
Try using IIf
UPDATE TableName
SET Sector = IIF(Sector IN(' ') AND ThType IN('Test1'), 'NameSector', 'NameSector1')
WHERE (Sector IN(' ') AND ThType IN('Test1')) OR (Sector IN(' ') AND ThType IN('Test2'))
CodePudding user response:
Access does not support CASE
expressions but you can use the function IIF()
:
UPDATE TableName
SET Sector = IIF('NameSector1' = 'Test1', 'NameSector1', 'NameSector')
WHERE Sector IN('') AND ThType IN ('Test1', 'Test2');