IIf Else SQL help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to write an If Else statement in SQL for a query in Access 2003
for managing GPA
Example:
If there is no score entered yet, assign 0
If the first score is >= 90, use the first score
If the second score is >= 90, assign 90 (can't score higher than 90 on retake)
Else assign the greater of the two scores (since neither are 90 or higher)

Here is an example of my code so far
IIf(IsNull([L1 E1 1st]),0,
IIf([L1 E1 1st]>=90,[L1 E1 1st],
IIf([L1 E1 2nd]>=90,90,
IIf([L1 E1 1st] >= [L1 E1 2nd],[L1 E1 1st],[L1 E1 2nd]))))
AS [L1 E1 Score],
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top