Select – Top 10

5 pts.
Tags:
Microsoft SQL Server 2000
Hello, I have to tables, one with name CONTRACT, second AGENT IN table CONTRACT these data: ClientID ClientName ClientSurname ContractNR AgentID AGENT data: ClientID Sum ContractNR I need to select 10 agent's clients, who have a bigest sum. One agent have 100 clients, second only 2 or one client. Sum is very different. The result may be :      clientID                  contractId      AgentID     Sum 1     48504051021         000001         112          10,15 2     54847584527         000002         112          20,26 . . . 10   45985485425         0001251       112           200,32 1     85462455545         0000125       156           100,65 . . . 10    23654755875        000056         156           900,23

Answer Wiki

Thanks. We'll let you know when a new response is added.

Thank you for visiting ITKE.

We are happy to help you with solving specific IT questions, but need as
much information as possible to do so. Let us know about the problem you
are trying to solve, how you are approaching it and what work you’ve
done so far, and we can help guide you in the right direction.
I will give you a hint:
SUB-SELECT and maybe a nested table expression.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following