Link to home
Create AccountLog in
Avatar of Angela4eva
Angela4eva

asked on

sql query help

SELECT Max(level) AS level1, ID
      FROM tblmylevels
      WHERE
      UPPER(Outcome) = UPPER('Yes')

but it should give the level if previous levels are also yes
so i also need to check levels less than the max(level
) and make sure the outcome is also yes
for example if level1=3 then i must make sure that for  level1=1 and level1=2
are also have a outcome of yes. otherwise if the level1=1 outcome is not yes
then level1 should be 0
ASKER CERTIFIED SOLUTION
Avatar of Erick37
Erick37
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Avatar of Lowfatspread
Lowfatspread
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
List few representative records, and the expected output.