Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 161
  • Last Modified:

IIF statement in SQL

Hi,
I have a query which I need to complete an If statment in the middle. At the moment I have

 IIf([tbl_adequacy_list.dox_fsa] = 0,False,True)

What I would like is for it to say if dox_fsa = True return Yes, otherwise return No; My query is;

INSERT INTO tbl_spn_finalised ( spn_id, spn_long_name, kyc_status, fsa, aml, aof, sub_acct, note_aof_live, notes_aof_archive, date_added )
SELECT tbl_SPNLookup.F1, tbl_adequacy_list.spn_name_a, tbl_kyc_status.kyc_status_name, IIf([tbl_adequacy_list.dox_fsa] = 0,False,True), tbl_adequacy_list.dox_aml, tbl_adequacy_list.dox_aof, tbl_adequacy_list.dox_sub_acct, tbl_adequacy_list.notes_aof_live, tbl_adequacy_list.notes_aof_archive, tbl_adequacy_list.date_added
FROM tbl_SPNLookup INNER JOIN (tbl_kyc_status INNER JOIN tbl_adequacy_list ON tbl_kyc_status.status_id = tbl_adequacy_list.kyc_statis_id) ON tbl_SPNLookup.F1 = tbl_adequacy_list.spn_id
ORDER BY tbl_SPNLookup.F1;
0
andyb7901
Asked:
andyb7901
  • 3
1 Solution
 
Rey Obrero (Capricorn1)Commented:


IIf([tbl_adequacy_list.dox_fsa] = 0,No,Yes)

or

IIf([tbl_adequacy_list.dox_fsa] = 0,"No","Yes")
0
 
andyb7901Author Commented:
What is dox_fsa is a yes no field? Would that makea a difference?
0
 
Rey Obrero (Capricorn1)Commented:
what type of data is field fsa on tbl_spn_finalised? is it text or Yes/No field?
0
 
Rey Obrero (Capricorn1)Commented:
<What if dox_fsa is a yes no field?>  Yes/No field = 0 is always false/No
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now