Hi,
I am writing a dynamic query where in i need to put data exclusion criteria by using two columns from a table.
The two columns which i am using are 'FLOP_PRICE_AMT' and 'REO_PRICE_AMT'. The condition goes like this, if FLOP_PRICE_AMT is less than 90% of REO_PRICE_AMT, then that record(entire row) would be eliminated from data retrieval.
Here you for my query,
I am writing a dynamic query where in i need to put data exclusion criteria by using two columns from a table.
The two columns which i am using are 'FLOP_PRICE_AMT' and 'REO_PRICE_AMT'. The condition goes like this, if FLOP_PRICE_AMT is less than 90% of REO_PRICE_AMT, then that record(entire row) would be eliminated from data retrieval.
Here you for my query,
Code:
select cbsa_name,sum(1) from hpi3.swap_analysis where cbsa_name like '%ABERD%'
AND Variables_of_subtotals='First Listing Date AFTER REO Take back'
AND SALE_AMOUNT_BEFORE_FCL is not NULL
AND spreadsheet_FCLYear_Group in ('2008-1','2008-2')
AND sqid is not NULL
AND REO_PRICE_AMT < 10000000
AND REO_RESALE_IND = 'Y'
AND FLOP_PRICE_AMT < 0.9 * REO_PRICE_AMT(This condition is wrong. I have simply put)
group by cbsa_name