I am trying to update a table using values from a mapping table. I think its an UPDATE and SELECT statement but I cant figure out how to handle conditions. This is in VBA Access.
I have two tables with following fields:
I need to do a mapping from mapTable but it has the following condition
Is there a way to capture this in a single SQL query?
I have two tables with following fields:
Code:
mainTable: [column1],[column2],[mapColumnA],[mapColumnB]
mapTable: [c1],[mapColumnA],[mapColumnB]
I need to do a mapping from mapTable but it has the following condition
Code:
If mainTable.[column1] = "000" or mainTable.[column1] = "001" Then
mainTable.[column2] = mapTable.[c1]
WHERE mapTable.[mapColumnA] = mainTable.[mapColumnA]
AND mapTable.[mapColumnB] = mainTable.[mapColumnB]
Else
mainTable.[column2] = mapTable.[c1]
WHERE mapTable.[mapColumnA] = mainTable.[mapColumnA]
End If
Is there a way to capture this in a single SQL query?
Last edited: