Home > Mobile >  how to display specific rows in sql
how to display specific rows in sql

Time:10-21

I have this rows in my table

Name    Grade        Comply
Alpha   2.5          NULL
Beta    Incomplete   NULL
Charlie Incomplete   3.0
Delta   1.5          NULL

I want to display only those with grades ex.(2.5,1.5) and grades with Incomplete but have value in comply column like charlie.

Name     Grade       Comply
Alpha    2.5         NULL
Charlie  Incomplete  3.0
Delta    1.5         NULL

Hope someone helps

CodePudding user response:

SELECT name, grade, comply
FROM table <tabname>
WHERE grade in ("2.5","1.5") 
OR (grade="Incomplete" and comply is not null);
  • Related