Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Help: How to get values of more than two columns in a group by ?
Folks,
I have a general question about GROUP BY functionality. assume that I have a table that keeps track of arrival dates of different guests. These guests arrive and leave several times. So each unique guest (unique last name) may have multiple arrival dates. If I write a query like:
SELECT last_name , MAX(arrive_date)
FROM arrival table
GROUP BY last_name ;
This query will print the latest arrival date of a specific guest. I know that this works.
How do I get the values for the other columns in the returned rows ? If I put the other column names in the SELECT and the GROUP BY clauses, I do not get the desired result.
Is there anyway to do this with the GROUP BY or any other equivalent SQL statement ?
Regards,
Sam
Received on Thu Jul 25 2002 - 19:31:37 CDT