Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL remove repeating rows 1

Status
Not open for further replies.

stiley

Programmer
Sep 5, 2006
14
0
0
CA
Hello,
I have an issue with SQL and I just cant seem to figure out the approach to achieve the result I need....

I have the following record set and I am wondering how I can remove certain rows.

C1[tab]C2[tab]C3[tab][tab]C4
A[tab]B[tab][tab]C[tab][tab]1
A[tab]C[tab][tab]C[tab][tab]2
A[tab]B[tab][tab]C[tab][tab]3
D[tab]E[tab][tab]F[tab][tab]1
D[tab]E[tab][tab]F[tab][tab]3
D[tab]E[tab][tab]F[tab][tab]5
G[tab]H[tab][tab]I[tab][tab]2
G[tab]H[tab][tab]I[tab][tab]4
G[tab]H[tab][tab]I[tab][tab]3


What I want is to be able to select out the rows for the repeatiung sets that have the largest number in Column4
So the result set would be like this

C1[tab]C2[tab]C3[tab][tab]C4
A[tab]B[tab][tab]C[tab][tab]3
D[tab]E[tab][tab]F[tab][tab]5
G[tab]H[tab][tab]I[tab][tab]4


Any insight is greatly appreciated
Thanks
Sean
 
SELECT C1,C2,C3,MAX(C4)
FROM yourTable
GROUP BY C1,C2,C3

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
It was a typo,
my bad. Thanks for the solution
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top