Hi SQL Gurus
The following query last column IIF( x=1, IIF( )) not showing the right reulst .
I would expect where the Source = "Initial Budget" and "WTE_Total" should show "Yes" and other rows sould show "NO"
but if you see the output in the screen below showing wrong and you can also see the IIF() condition in the SQL below as well
appreciate your help
Thanks
Farhan
The following query last column IIF( x=1, IIF( )) not showing the right reulst .
I would expect where the Source = "Initial Budget" and "WTE_Total" should show "Yes" and other rows sould show "NO"
but if you see the output in the screen below showing wrong and you can also see the IIF() condition in the SQL below as well
appreciate your help
Thanks
Farhan
SQL:
SELECT qry_bp_revised_adjustment_output_07.source,
qry_bp_revised_adjustment_output_07.id,
qry_bp_revised_adjustment_output_07.account_id,
qry_bp_revised_adjustment_output_07.fin_yr,
qry_bp_revised_adjustment_output_07.period,
qry_bp_revised_adjustment_output_07.model_id,
qry_bp_revised_adjustment_output_07.comment,
qry_bp_revised_adjustment_output_07.elements,
Sum(qry_bp_revised_adjustment_output_07.bud_val) AS SumOfBud_Val,
qry_bp_revised_adjustment_output_07.bud_profile,
qry_bp_revised_adjustment_output_07.wte_profile,
Sum(qry_bp_revised_adjustment_output_07.sumofwte_val) AS SumOfSumOfWTE_Val,
Sum(qry_bp_revised_adjustment_output_07.wte_val_adjustment) AS SumOfWTE_Val_Adjustment,
IIF(
qry_bp_revised_adjustment_output_07.source = "Initial Budget",
IIF(qry_bp_revised_adjustment_output_07.source = "WTE Total",
"Yes" ,"NO"
)) AS Total_WTE
FROM qry_bp_revised_adjustment_output_07
GROUP BY qry_bp_revised_adjustment_output_07.source,
qry_bp_revised_adjustment_output_07.id,
qry_bp_revised_adjustment_output_07.account_id,
qry_bp_revised_adjustment_output_07.fin_yr,
qry_bp_revised_adjustment_output_07.period,
qry_bp_revised_adjustment_output_07.model_id,
qry_bp_revised_adjustment_output_07.comment,
qry_bp_revised_adjustment_output_07.elements,
qry_bp_revised_adjustment_output_07.bud_profile,
qry_bp_revised_adjustment_output_07.wte_profile;