本人刚学习,请大家帮忙一下,这个SQL怎么去重复
SELECT 
 tb_PhoneCard.PCNumber, tb_PhoneCard.PCSerialNumber, tb_Vendor.VendorName,
 tb_UsingType.UsingTypeName,tb_PCType.PCTypeName,tb_PhoneCard.InternationalRoaming,tb_MobileTelephone.MTSerialNumber,
tb_BusinessTransaction.BusinessTransactionName FROM tb_PhoneCard INNER JOIN tb_Vendor
 ON tb_PhoneCard.VendorId = tb_Vendor.VendorId  INNER JOIN tb_MobileTelephone ON tb_PhoneCard.MTSerialNumber=tb_PhoneCard.MTSerialNumber
 INNER JOIN  tb_PCType ON tb_PhoneCard.PCTypeId=tb_PhoneCard.PCTypeId
 INNER JOIN tb_UsingType ON tb_PhoneCard.UsingTypeId = tb_UsingType.UsingTypeId 
INNER JOIN  tb_BusinessTransaction  ON tb_PhoneCard.BusinessTransactionId=  tb_BusinessTransaction.BusinessTransactionId显示的结果:
13312222222 002PC 中国电信 长期使用 SIM卡 是         RM-335 286-Iphone 4
13312222222 002PC 中国电信 长期使用 SIM卡 是         RM-336 286-Iphone 4
13312222222 002PC 中国电信 长期使用 SIM卡 是         RM-337 286-Iphone 4
13312222222 002PC 中国电信 长期使用 SIM卡 是         RM-338 286-Iphone 4
13312222222 002PC 中国电信 长期使用 SIM卡 是         RM-339 286-Iphone 4
13312222222 002PC 中国电信 长期使用 CDMA卡 是         RM-335 286-Iphone 4
13312222222 002PC 中国电信 长期使用 CDMA卡 是         RM-336 286-Iphone 4
13312222222 002PC 中国电信 长期使用 CDMA卡 是         RM-337 286-Iphone 4
13312222222 002PC 中国电信 长期使用 CDMA卡 是         RM-338 286-Iphone 4
13312222222 002PC 中国电信 长期使用 CDMA卡 是         RM-339 286-Iphone 4
13312222222 002PC 中国电信 长期使用 3G卡 是         RM-335 286-Iphone 4
13312222222 002PC 中国电信 长期使用 3G卡 是         RM-336 286-Iphone 4
13312222222 002PC 中国电信 长期使用 3G卡 是         RM-337 286-Iphone 4
13312222222 002PC 中国电信 长期使用 3G卡 是         RM-338 286-Iphone 4
13312222222 002PC 中国电信 长期使用 3G卡 是         RM-339 286-Iphone 4
13961607595 PC001 中国移动 长期使用 SIM卡 否         RM-335 286-Iphone 4
13961607595 PC001 中国移动 长期使用 SIM卡 否         RM-336 286-Iphone 4
13961607595 PC001 中国移动 长期使用 SIM卡 否         RM-337 286-Iphone 4
13961607595 PC001 中国移动 长期使用 SIM卡 否         RM-338 286-Iphone 4
13961607595 PC001 中国移动 长期使用 SIM卡 否         RM-339 286-Iphone 4
13961607595 PC001 中国移动 长期使用 CDMA卡 否         RM-335 286-Iphone 4
怎么样去掉重复的

解决方案 »

  1.   

    有个关键字叫distink什么的可以
    举例: select distink  A from table   ,这时查询出来的A就没重复的
      

  2.   

    select distinct  去重复
    http://sql.1keydata.com/cn/sql-distinct.php
      

  3.   

    select distinct * from #table
      

  4.   

    select distinct (查找的列名) from 表
      

  5.   


    select distinct * from (
    SELECT  
     tb_PhoneCard.PCNumber, tb_PhoneCard.PCSerialNumber, tb_Vendor.VendorName,
     tb_UsingType.UsingTypeName,tb_PCType.PCTypeName,tb_PhoneCard.InternationalRoaming,tb_MobileTelephone.MTSerialNumber,
    tb_BusinessTransaction.BusinessTransactionName FROM tb_PhoneCard INNER JOIN tb_Vendor
     ON tb_PhoneCard.VendorId = tb_Vendor.VendorId INNER JOIN tb_MobileTelephone ON tb_PhoneCard.MTSerialNumber=tb_PhoneCard.MTSerialNumber
     INNER JOIN tb_PCType ON tb_PhoneCard.PCTypeId=tb_PhoneCard.PCTypeId
     INNER JOIN tb_UsingType ON tb_PhoneCard.UsingTypeId = tb_UsingType.UsingTypeId  
    INNER JOIN tb_BusinessTransaction ON tb_PhoneCard.BusinessTransactionId= tb_BusinessTransaction.BusinessTransactionId
    ) aa
      

  6.   


    这样写没用,我试过的,PCTypeName,MTSerialNumber就是这两个字段取出了全部的内容,我要的是一个主键对应一个内容,而不是一个主键取出了全部内容