首页 > 解决方案 > 所以我试图从一个表中过滤重复项,以便它只显示一个版本的数据组合

问题描述

图片链接,因为我还不能发布图片

所以这就是我为过滤它而写的,但它缺少一些东西,我不知道.....

select rpad(g.game_id, 5, ' ') as game,
rpad(p1.name, 10, ' ') as platform1,
rpad(p2.name, 10, ' ') as platform2,
rpad(p3.name, 10, ' ') as platform3,
rpad(p4.name, 10, ' ') as platform4
from game g, game_platform gp1, game_platform gp2, 
game_platform gp3, game_platform gp4, 
platform p1, platform p2, platform p3, platform p4
where g.game_id = gp1.game_id
and g.game_id = gp2.game_id
and g.game_id = gp3.game_id
and g.game_id = gp4.game_id
and gp1.platform_id = p1.platform_id
and gp2.platform_id = p2.platform_id
and gp3.platform_id = p3.platform_id
and gp4.platform_id = p4.platform_id
and gp1.platform_id <> gp2.platform_id
and gp1.platform_id <> gp3.platform_id
and gp1.platform_id <> gp4.platform_id
and gp2.platform_id <> gp3.platform_id
and gp2.platform_id <> gp4.platform_id
and gp3.platform_id <> gp4.platform_id
;

标签: sqlplus

解决方案


推荐阅读