我在申请协会时工作。 NET C#
I want to view all the duplicated records in a Grid view Control.
I normally use “SqlDataSource” control.
请注意,我不想有一两条共同点的行文,我正试图找到除(PK)外一切相同的行文。
我希望大家理解这个问题。 感谢 您需要任何其他资料 请问我。
我在申请协会时工作。 NET C#
I want to view all the duplicated records in a Grid view Control.
I normally use “SqlDataSource” control.
请注意,我不想有一两条共同点的行文,我正试图找到除(PK)外一切相同的行文。
我希望大家理解这个问题。 感谢 您需要任何其他资料 请问我。
SELECT column1, column2, column3, column4, COUNT(1)
FROM yourtable
GROUP BY column1, column2, column3, column4
HAVING COUNT(1) > 1
简而言之,最简单的办法是:
select column1, column2, ... /* all columns except ID */
from myTable
group by column1, column2, ... /* all columns except ID */
having count(*) > 1
您可以把记录整理成册,并记录在你的 que中:
select col1, col2, col3, count(1)
from table
group by col1, col2, col3
having count(1) > 1
There are several ways to do this, here is another:
SELECT t1.*
FROM MyTable t1
INNER JOIN MyTable t2
ON t1.field1 = t2.field1 AND t1.field2 = t2.field2 AND t1.field3 = t2.field3 ... etc ...
WHERE t1.PKID <> t2.PKID
select
col1,
col2,
col3
from
(
select
col1,
col2,
col3,
row_number() over(partition by Col1, Col2, Col3, ColN order by Col3) rownum
from yourTable
)a
where rownum > 1
使用了ROW_NUMBER(
>)功能,根据重复情况(partition by条)排列了你的记录。 然后选择所有重复的行文。
如果没有看到你确切的表层结构,这个通用塔就象我可以提供的那样具体。
谢谢大家,这是我所期待的。
select ProductID, Date, Category, COUNT(*)from Table1GROUP BY ProductID, Date, Category HAVING COUNT(*) > 1 -- gets only rows with more than 1 grouping
In my webpages I have references to js and images as such: "../../Content/Images/"Filename" In my code if I reference a file as above, it doesnt work so i have to write: "c:/miscfiles/"filename" 1-...
I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...
Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...
I m looking for best practices here. Sorry. I know it s subjective, but there are a lot of smart people here, so there ought to be some "very good" ways of doing this. I have a custom object called ...
I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...
i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...
For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?
I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!