Advertisement

03.27.2008 at 08:10AM PDT, ID: 23274296
[x]
Attachment Details

distinct count

Asked by lobos in MS SQL Server

I have a table with 4 columns and there are many many records. I need to run a query to report back how many
distinct records there are and if some of them are duplicated.
This sql table does not have any primary keys so when the import of data from access was done, the same record could have been inserted multiple times
so I figure a query that returns all the distinct records and a count of how many are there it will help determine this. See below is a total of 8 records
but my query with the distinct should only return 4 records back and a counter.

I look forward to some feedback



filename      itemnumber      description

23423.jpg      345            this is for the west side
24443.jpg      346            this is for the noth side
33423.jpg      347            this is for the south side
44423.jpg      348            this is for the east side
23423.jpg      345            this is for the west side
23423.jpg      345            this is for the west side
33423.jpg      347            this is for the south side
44423.jpg      348            this is for the east side



filename      count

23423.jpg      3
24443.jpg      1
33423.jpg      2
44423.jpg      2Start Free Trial
[+][-]03.27.2008 at 08:14AM PDT, ID: 21222265

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: MS SQL Server
Sign Up Now!
Solution Provided By: derekkromm
Participating Experts: 3
Solution Grade: A
 
 
[+][-]03.27.2008 at 08:14AM PDT, ID: 21222271

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.27.2008 at 08:16AM PDT, ID: 21222291

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628