摘要: 查询同一个表中某一字段值相同的记录select * from 表名where 字段 in(select 字段 from 表名 group by 字段 having count(1)>1)select * from 表名 awhere exists (select 1 from 表名 where 字段=a.字段 and 主键 a.主键)用select top 查询出多条记录的解决这个问题在开发的时候经常会遇到,比如写了一句查询5条记录的语句“SELECT top 5 * FROM article order by Hits desc”结果显示结果多于5条。是因为,当判断条件Hits有重复时 阅读全文
posted @ 2014-03-08 21:52 xingrun 阅读(662) 评论(0) 推荐(0) 编辑