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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

again to find MAX records-

Status
Not open for further replies.

chamilz

MIS
Joined
Feb 10, 2005
Messages
102
Location
CA
i am posting this questions again since i couldnt find a sulution....i better explain my question in detail

my table has records set like below... and need a query like this....
select distinct(col1...col6) for max(col6)

always (col1--col5)is considered as a unique set... /Thanks

col1 col2 col3 col4 col5 col6
48019 459907989 002 1 920--- 01677
48019 459907989 002 1 920 03406
48019 459907989 002 2 930 01677
48019 459907989 002 2 930 03406
48019 459907989 002 3 950 01677
48019 459907989 002 3 950 03406
48019 459907989 002 3 960 01677
48019 459907989 002 3 960----max 03406 03406
48019 459907989 101 1 920 00157
48019 459907989 101 1 920 03405
48019 459907989 101 2 930 00157
48019 459907989 101 2 930 03405
48019 459907989 101 3 950 00157
48019 459907989 101 3 950 03405
48019 459907989 101 3 960 00157
48019 459907989 101 3 960--max 03405 03405
48019 459907989 201 1 920--- 01383
48019 459907989 201 1 920 03410
48019 459907989 201 2 930 01383
48019 459907989 201 2 930 03410
48019 459907989 201 3 950 01383
48019 459907989 201 3 950 03410
48019 459907989 201 3 960 01383
48019 459907989 201 3 960--max 03410 etc.. 03410
48019 459907989 203 1 920 00330
48019 459907989 203 2 930 00330
48019 459907989 203 3 950 00330
48019 459907989 203 3 960 00330
48019 459907989 215 1 920 01707
48019 459907989 215 1 920 03409
48019 459907989 215 2 930 01707
48019 459907989 215 2 930 03409
48019 459907989 215 3 950 01707
48019 459907989 215 3 950 03409
48019 459907989 215 3 960 01707
48019 459907989 215 3 960 03409 --max 03419
48019 459907989 302 1 920 01695
48019 459907989 302 2 930 01695
 
try
Code:
 select col1, col2, col3, col4, col5, max(col6) as Max6
from table
group by col1, col2, col3, col4, col5
I don't think you made it clear that the columns 'go together' in your previous post.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Thanks Greg...
i was really in a rush...couldnt explain in detail and cant think even a simple query..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top