Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert IIF to SQL 1

Status
Not open for further replies.
Joined
Jun 29, 2001
Messages
195
Location
US
Can anyone help convert the IIF statement below to SQL.
Thanks much.

SELECT dbo_points.REC_ID, dbo_points.AB_93, dbo_points.AB_93Rev, dbo_points.AB_93RevAmount, IIf([AB_93Rev]=-1,[AB_93RevAmount],[AB_93]) AS AB_93X
FROM dbo_points;

8-) Ashley L Rickards
SQL DBA
 

Use a CASE statement.

SELECT
REC_ID,
AB_93,
AB_93Rev,
AB_93RevAmount,
Case
When AB_93Rev=-1 Then AB_93RevAmount
Else AB_93
End AS AB_93X
FROM dbo_points
Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top