How do I create an 'IF' function in a query rather than as an expression??
I have created the following query:
SELECT MATTER_NO, BALANCE, WIP_TOLERANCE
I need the WIP_TOLERANCE to return '80' whenever the value is '0'. Whenever the value is not zero I want it to return that value. (EG if WIP_TOLERANCE is 5, return 5, if WIP_TOLERANCE is 0, always return 80)
I know how to do this by creating an expression using the IIF function, however I need this to be written into the query as I also need it to be a part of the WHERE clause. (Ie WHERE BALANCE>WIP_TOLERANCE - I never want to be <0)
Any help asap would be fantastic!!!
Microsoft DevelopmentMicrosoft SQL Server 2005Microsoft SQL Server