本人刚学习,请大家帮忙一下,这个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
怎么样去掉重复的
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
怎么样去掉重复的
解决方案 »
- 求解:一个文本复制按钮的问题
- Repeater全部导出excel后,再分页显示!
- 如果有一天你发现你的visual stdio变成了这个样子......
- 大虾请进:GridView取值老问题,解决不了!
- 高分求助 类似QQ的网络通讯源码 各位大哥帮帮忙拉
- 在sql server查询分析器中,如何可以对select出来的记录进行编辑
- 关于table的技术问题!!!
- |M| 如何将网页中生成HTML以后将<Img>标签中的SRC 添加 "http://www.myweb.com"
- 水晶报表怎样把数据库中两张表显示到一个报表里面? help me!!!
- 关于uploadify多图上传的问题
- Reapter 控件 里的dropdownlist 赋值的问题
- 如何制作CAB文件,数字签名,.INF文件然后进行安装???谁做过啊,帮帮我!!!
举例: select distink A from table ,这时查询出来的A就没重复的
http://sql.1keydata.com/cn/sql-distinct.php
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
这样写没用,我试过的,PCTypeName,MTSerialNumber就是这两个字段取出了全部的内容,我要的是一个主键对应一个内容,而不是一个主键取出了全部内容