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],
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],