如何从SQL Server表中获取不同的行 [英] how to get the distinct row from sql server table
本文介绍了如何从SQL Server表中获取不同的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的表中有重复的行,我想检测出重复的行如何获取它
例如我的桌子有以下
In my table has duplicate rows I want to detect the duplicate rows how to get it
For example my table has following
SeqNo Date Desc Amount Debit Credit
2 07/12/2012 PurchaseReturn(CR) 12000 0 12000
2 07/12/2012 PurchaseReturn(CR) 12000 0 12000
2 07/12/2012 Cash A/C(DR) 12000 12000 0
在上面的第一行和第二行中相同.所以我只想排一排
怎么做,请帮帮我
谢谢
In the above 1st and 2nd Rows are Same. So I want get only one row
How to do it please help me
Thank you
推荐答案
select distinct * from your_tablename
试试吧…….
Try it................
嗨
检查此内容,以获得对SQL中独特"的基本理解
http://www.w3schools.com/sql/sql_distinct.asp [
hi
check this, for basic understanding on "Distinct" in SQL
http://www.w3schools.com/sql/sql_distinct.asp[^]
您好,
你可以用任何一种方式...
hello,
you can get either way...
select prefix from userlist group by prefix
select distinct prefix from userlist
可能正是您想要的.
May be this right what you want.
这篇关于如何从SQL Server表中获取不同的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文