Using SQL how to get only certain rows from a query to appear on the report under if else statements
Posted on 2006-07-14
I'm trying to build a custom report which uses SQL. I've created a dervied column called - BAR_B_INV.U_DOS_GREATER_345. The results in that column either say 'NOT AGE' or 'AGE'
In my custom report under the display section for that column, I only want that row to print on my report if the value in that column = 'AGE'.
I tried the following statement, but I get a syntax error - IF BAR_B_INV.U_DOS_GREATER_345='NOT AGE' THEN BLANK ELSE BAR_B_INV.U_DOS_GREATER_345
Here is an example of the data:
PAT_NM SER_DT CHG_AMT INV_NUM BAR_B_INV.U_DOS_GREATER_345
MOORE,CATHERINE 1/23/2006 107 8000658 AGE
TEST,RICHARD 5/4/2006 42 8000360 NOT AGE
TEST,RICHARD 3/31/2006 42 8000361 NOT AGE
I would only want the first row to print on my report as this has the value of 'AGE' in that column. I would not want the other 2 rows to print.
How can this be done?