Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Help: How to get values of more than two columns in a group by ?

Help: How to get values of more than two columns in a group by ?

From: Sam Talebbeik <sam777t_at_yahoo.com>
Date: 25 Jul 2002 17:31:37 -0700
Message-ID: <9ec3a1ef.0207251631.786ebe62@posting.google.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US