这是我的代码:
select case when grades.grade >= 8 then students.name end,
grades.grade,students.marks
from students, grades
where students.name is not null
order by grades.grade desc, students.name;
我要做的是隐藏students.name = NULL的所有值,例如
NULL 7 77
NULL 7 34
NULL 7 89
NULL 7 78
NULL 7 95
NULL 7 88
NULL 7 55
NULL 7 94
NULL 7 64
我想知道如何删除上面的值?
答案 0 :(得分:0)
您可以尝试以下代码:
select case when grades.grade >= 8 then students.name else 'ABC' end, grades.grade,students.marks
from students, grades
where students.name is not null AND grade >= 8
order by grades.grade desc, students.name;
这将消除您收到的分数小于8的所有空值。