使用distingle子句时查询返回空列表

时间:2018-08-07 12:45:33

标签: sql oracle oracle11g

我有两个确切的查询,唯一的区别是“ distinct子句”:

这将返回大约200个元素的列表:

select v."ID", v."LOGIN", v."PASSWORD"
from vilians v 
left join terrain e on (v.terrain_group_id = e.terrain_group_id)   
left join auth_terrain av on (v.id = av.villian_id and av.terrain_id = e.id)  
left join messages s on (v.id = s.villian_id and s.terrain_id = av.terrain_id and av.villian_id = s.villian_id) 
where v.terrain_group_id = '8a8484436514171a0165143979b60b93'

这不返回任何内容:

select distinct v."ID", v."LOGIN", v."PASSWORD"
from vilians v 
left join terrain e on (v.terrain_group_id = e.terrain_group_id)   
left join auth_terrain av on (v.id = av.villian_id and av.terrain_id = e.id)  
left join messages s on (v.id = s.villian_id and s.terrain_id = av.terrain_id and av.villian_id = s.villian_id) 
where v.terrain_group_id = '8a8484436514171a0165143979b60b93'

表中的所有字段均为varchar2。 这是没有明显区别的示例结果:

ID                               LOGIN  PASSWORD                                                                                                                                                                                                                                                       

8a8484436514171a0165144209701ee1 jr8anvbp 8tOm1UO3uEZrx7CtW5ZEYg==                                                                                                                                                                                                                                       
8a8484436514171a0165144209701ee1 jr8anvbp 8tOm1UO3uEZrx7CtW5ZEYg==                                                                                                                                                                                                                                       
8a8484436514171a0165144209701ee3 9j2c5jus u6adS77yiA6D2N+NMhpnbg==                                                                                                                                                                                                                                       
8a8484436514171a0165144209701ee3 9j2c5jus u6adS77yiA6D2N+NMhpnbg==                                                                                                                                                                                                                                       
8a8484436514171a0165144209701ee3 9j2c5jus u6adS77yiA6D2N+NMhpnbg==                                                                                                                                                                                                                                       
8a8484436514171a0165144209701ee3 9j2c5jus u6adS77yiA6D2N+NMhpnbg==                                                                                                                                                                                                                                       
8a8484436514171a0165144209701ee3 9j2c5jus u6adS77yiA6D2N+NMhpnbg==                                                                                                                                                                                                                                       
8a8484436514171a0165144209701ee3 9j2c5jus u6adS77yiA6D2N+NMhpnbg==                                                                                                                                                                                                                                       
8a8484436514171a0165144209701ee5 5j4yp8aj OTH+ofKXUMkmIWMrswzD4w==                                                                                                                                                                                                                                       
8a8484436514171a0165144209701ee5 5j4yp8aj OTH+ofKXUMkmIWMrswzD4w==                                                                                                                                                                                                                                       

Oracle版本是11g Express Edition 11.2.0.2.0-64位产品。

发生这种情况的任何原因?

0 个答案:

没有答案