Ask a Question related to Microsoft SQL / MS SQL Server, Design and Development.
-
Dinesh.T.K #1
Re: counting duplicates
Jane,
SELECT field1,count(field1) 'Counter'
FROM <tgablename>
GROUP BY field1
--
Dinesh.
SQL Server FAQ at
[url]http://www.tkdinesh.com[/url]
"Jane K." <Jane@123.com> wrote in message
news:00ea01c33f24$e5155960$a301280a@phx.gbl...> How can I set up a counter so that whenever there is a
> duplicate records, the counter will increase by one. In
> other words, I would like to find out how to make the list
> looks like this:
>
> Field 1: Counter:
> A 1
> B 1
> C 1
> C 2
> D 1
> E 1
>
> Thank you in advance to answer my question.
>
>
>
Dinesh.T.K Guest
-
Find duplicates
Hey all, I want to give the user a dialog where they can find pairs of duplicate entries in the database and resolve these down to a single... -
SQL Duplicates
Hi all, I'm facing the next problem: I've got a table like this: Name Size Total Martens 200 2 Martens 300 ... -
checking duplicates
Hi all, i'm trying to figure out how I can check for duplicates entries in an array and remove the duplicate. Example: 23,23,39,40,44,44 should... -
Eliminating duplicates
Hi, I have a view with the following columns: member_rating_id ,rating_table_id ,member_id ,screen_name ,rating_value ,number_won... -
No Duplicates
Is there a way so you make filemaker not accept any duplicate enteries into a certian fields ie; UserName: <field> Is there a way to make it... -
John Bell #2
Re: counting duplicates
Hi
You don't give the DDL for the table, but if you had a separate Unique Index
or Primary Key field(s) say PKFld the following sql may work (untested)
SELECT b.Field1, ( SELECT COUNT(*) FROM MyTable A
WHERE a.PkFld <= b.PKFld AND a.Field1 =
b.Field1 ) AS Counter
FROM MyTable B
Order by b.Field1, b.PkFld
John
"Jane K." <Jane@123.com> wrote in message
news:00ea01c33f24$e5155960$a301280a@phx.gbl...> How can I set up a counter so that whenever there is a
> duplicate records, the counter will increase by one. In
> other words, I would like to find out how to make the list
> looks like this:
>
> Field 1: Counter:
> A 1
> B 1
> C 1
> C 2
> D 1
> E 1
>
> Thank you in advance to answer my question.
>
>
>
John Bell Guest



Reply With Quote

