yippie_ky_yay
Registered User.
- Local time
- Yesterday, 23:45
- Joined
- Jul 30, 2002
- Messages
- 338
Hello forum,
I was wondering if you can put a little "if" statement in a querry or not?
ie say you have a single table that you are not allowed to alter which contains 2 fields - "price" and "tax". In a query we can create the "total" column like so:
SELECT tableEx.price, tableEx.tax, ([price]+[tax]) AS Total
FROM tableEx;
But say I decide that all records that have "0.00" in the tax field should have a value of "5.00" in the total, regardless of what is in the price. Could a statement like:
IF table.tax = 0.00 THEN
Total = 5.00
ELSE
Total = tableEx.price + tableEx.tax
End IF
be added somewhere?
Any help would be much appreciated!
I was wondering if you can put a little "if" statement in a querry or not?
ie say you have a single table that you are not allowed to alter which contains 2 fields - "price" and "tax". In a query we can create the "total" column like so:
SELECT tableEx.price, tableEx.tax, ([price]+[tax]) AS Total
FROM tableEx;
But say I decide that all records that have "0.00" in the tax field should have a value of "5.00" in the total, regardless of what is in the price. Could a statement like:
IF table.tax = 0.00 THEN
Total = 5.00
ELSE
Total = tableEx.price + tableEx.tax
End IF
be added somewhere?
Any help would be much appreciated!