简体   繁体   中英

Remove duplicates from left join

Table A:

MSISDN  A   B   C
990 1   2   3
992 1   2   3
995 1   2   3
993 1   2   3
991 1   2   3
994 1   2   3

Table B:

990 2   2   3
992 2   2   4
993 1   2   3
994 1   2   3
995 1   6   3
990 1   2   3
991 2   2   3
992 2   2   3
995 1   2   3

select msis1.msisdn,msis1.a,msis2.c from msis1 left join msis2 on msis1.msisdn=msis2.msisdn;

MSISDN  A   C
990 1   3
992 1   4
993 1   3
994 1   3
995 1   3
990 1   3
991 1   3
992 1   3
995 1   3

I want to modify the above query not to get duplicate records

尝试SELECT DISTINCT ,这只会选择唯一的行。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM