Reputation: 35
I have a table in ACCESS. I need to implement a SQL query/macro to add another field to it.
ID F1 F2 F3
1 1 2 3
2 5 6 9
3 4 2 3
I need to add a field F4 which has the following formula :-
F4 = IF(MIN(F1,F2-F3)>0,MIN(F1,F2-F3),0)
Thanks.
Upvotes: 0
Views: 948
Reputation: 1372
To implement a minimum function you can follow this Knowlegde Base article: ACC2000: How to Find Minimum or Maximum Value Across Fields of Record.
Then, your query in Access should be something like:
SELECT f1, f2, f3, IIF(Minimum(f1, f2-f3)>0,Minimum(f1, f2-f3),0) AS f4
FROM tempDb
Upvotes: 2