Use the IIf («expr», «truepart», «falsepart») function.
SELECT Table.Field1,
Table.Field2,
Table.Field3,
IIf([Field2]="A",[Field3],"") AS FieldA,
IIf([Field2]="B",[Field3],"") AS FieldB
FROM [Table];
Assuming that your table name is Table. Use the IIF statement. This statement evaluates an expression on the first argument. After evaluating it you use the second argument to tell it what to do if it comes back as true, if it comes back as false you tell it what you want it to do on the third argument.
Hope it helps.
Sal
|