Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Database/JDBC/SQL/JDO/Hibernate  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 如何筛选掉两个相同的结果?
gaoxt1983





发贴: 67
积分: 0
于 2006-08-13 15:00 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
现在有一个表(access 2000),其中的纪录有很多是除了其中一个字段不同以外其他的都相同,现在要求把所有纪录全select出来(不包括那个可能不同的字段),但是要求不能有重复,怎么做?我用DISTINCT好像没法对*作……救救我啊……


作者 Re:如何筛选掉两个相同的结果? [Re:gaoxt1983]
Jcat

熊猫的猫



发贴: 266
积分: 16
于 2006-08-13 20:40 user profilesend a private message to usersend email to Jcatsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
SELECT DISTINCT c1, c2 .... from table1;
c1,c2 ....里不包括那个你不需要的字段

你是嫌“纪录有很多”,不愿意一一typing吗?我也不知道了,观望~



编程,游泳,睡觉--SleepingCat
作者 Re:如何筛选掉两个相同的结果? [Re:gaoxt1983]
gaoxt1983





发贴: 67
积分: 0
于 2006-08-14 09:10 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
哦,原来还要一个字段一个字段写啊,为什么不能用*呢,真麻烦!


作者 Re:如何筛选掉两个相同的结果? [Re:gaoxt1983]
Jcat

熊猫的猫



发贴: 266
积分: 16
于 2006-08-14 20:57 user profilesend a private message to usersend email to Jcatsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
http://www.wenyiwen.cn/w6101/20050228/20050228__3760124.html

http://www.cndevx.com/club/printpage.asp?BoardID=30&ID=50434

又搜了搜,唯一的结果就是:“在编程时,你应该全部写出所有字段,因为这样的速度会比 select * from 等方式快 ”

我看这懒咱们还真偷不成了。



编程,游泳,睡觉--SleepingCat
作者 Re:如何筛选掉两个相同的结果? [Re:gaoxt1983]
gaoxt1983





发贴: 67
积分: 0
于 2006-08-15 08:30 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
对了,再烦你们一次,我的数据库不大好,只是懂点sql,和基本的东西(视图阿什么的),有必要学点其他关于数据库的东西吗?



flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923