Advertisement

10.01.2008 at 10:40AM PDT, ID: 23778931
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.1

Help with SQL query and update

Asked by gfk76 in MS SQL Server, SQL Query Syntax, SQL Server 2005

Tags:

Hi Experts!

I was hoping one of you SQL gurus could help with a SQL Query for my MS SQL 2005 database.

I have a customer table with approxmently 300 000 records.
In this table some customers are listed more than once with the same customerid.
My Table looks like this

ID (Bigint,ISIdentity=Yes)
Customerid(nvarchar)
Lastname(nvarchar)
Firstname(nvarchar)
Adress(nvarchar)
Zip(nvarchar)
City(nvarchar)
Duplicate(bit)

I have a query today that helps me list all duplicates, but I would like to flag the customer with
the highest ID as a duplicate record.
See third record marked with'*'

See example
ID      Customerid      Firstname      Lastname      Adress            Zip      City      Duplicate
1      100000            James            Clark            Evergreen 5      12345      Mytown      False
2      100002            Jane            Doe            Somestreet 3      12345      Hertown      False
*3      100000            James            Clark            Evergreen 5      12345      Mytown      True

The query that I use to list duplicates are as follows:

SELECT * FROM
Customers A Inner Join (
Select Customerid, Lastname, Firstname
from Customers
group by Customerid, Lastname, Firstname
having count(*)>1 )T
ON A.Customerid = T.Customerid

Is it possible to update the customer with the higest ID with a True Flag from this query.

I am pretty new to SQL, and any help would be much appreciated.

Best regards
gfk76
Start Free Trial
[+][-]10.01.2008 at 10:45AM PDT, ID: 22616963

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 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 10:46AM PDT, ID: 22616981

View this solution now by starting your 14-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

Zones: MS SQL Server, SQL Query Syntax, SQL Server 2005
Tags: MS SQL
Sign Up Now!
Solution Provided By: BrandonGalderisi
Participating Experts: 3
Solution Grade: A
 
 
[+][-]10.01.2008 at 10:48AM PDT, ID: 22617001

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 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 11:27AM PDT, ID: 22617437

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 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 11:37AM PDT, ID: 22617552

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

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

 
[+][-]10.01.2008 at 11:40AM PDT, ID: 22617583

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 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 11:59AM PDT, ID: 22617796

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 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 12:03PM PDT, ID: 22617821

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 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 12:07PM PDT, ID: 22617857

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

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

 
[+][-]10.01.2008 at 12:09PM PDT, ID: 22617887

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 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 12:11PM PDT, ID: 22617909

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 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 12:13PM PDT, ID: 22617923

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 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.01.2008 at 12:17PM PDT, ID: 22617960

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

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

 
[+][-]10.01.2008 at 01:23PM PDT, ID: 22618615

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 14-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-43 / EE_QW_2_20070628