对成绩进行AB级的划分出现名字重复的两列并且没有数据目前用的列转行。

image.png

image.png

帆软用户bdlBLqiomK 发布于 2022-6-29 15:18 (编辑于 2022-6-29 15:49)
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
0
danhuaLv3见习互助
发布于2022-6-29 16:19(编辑于 2022-6-29 16:33)

方便发下SQL吗,我改下你的SQL给你看

image.png

  • 帆软用户bdlBLqiomK 帆软用户bdlBLqiomK(提问者) select name, (case when English>=80 and English<=100 then \'A\' when English>=70 and English<80 then \'B\' when English>=60 and English<70 then \'C\' when English>=0 and English<60 then \'D\' end) English, (case when French>=80 and French<=100 then \'A\' when French>=70 and French<80 then \'B\' when French>=60 and French<70 then \'C\' when French>=0 and French<60 then \'D\' end) French from (select name,(case course when \'English\' then grade end)as English,(case course when \'French\' then grade end)as French from stscore)
    2022-06-29 16:20 
  • danhua danhua 回复 帆软用户bdlBLqiomK(提问者) select NAME, (CASE WHEN English >= 80 AND English <= 100 THEN \'A\' WHEN English >= 70 AND English < 80 THEN \'B\' WHEN English >= 60 AND English < 70 THEN \'C\' WHEN English >= 0 AND English < 60 THEN \'D\' END) ENGLISH, (CASE WHEN French >= 80 AND French <= 100 THEN \'A\' WHEN French >= 70 AND French < 80 THEN \'B\' WHEN French >= 60 AND French < 70 THEN \'C\' WHEN French >= 0 AND French < 60 THEN \'D\' END) FRENCH from (select NAME,COURSE,GRADE from STSCORE)pivot (MAX(GRADE) for COURSE in (\'English\' as English,\'French\' AS French));
    2022-06-29 16:30 
最佳回答
0
Z4u3z1Lv6专家互助
发布于2022-6-29 15:35

写不来 用条件属性吧

WorkBook1.zip

image.png

image.png

  • 2关注人数
  • 371浏览人数
  • 最后回答于:2022-6-29 16:33
    请选择关闭问题的原因
    确定 取消
    返回顶部