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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Simple SQL - GROUP BY

Re: Simple SQL - GROUP BY

From: Filip Hanik <fhanik_at_digitalworkforce.net>
Date: Fri, 2 Jul 1999 09:00:16 -0700
Message-ID: <sk5f3.12$FE6.3789@typhoon-sf.snfc21.pbi.net>


Thanks guys,
Yes it doesn't matter what person ID as long as it belongs to the specific company.
Have a great weekend..

Filip

Joan Batiste Paya <centrisa_at_upvnet.upv.es> wrote in message news:7lia2q$hg4$1_at_polaris.cc.upv.es...
> Dear Filip:
>
> If you don't matter the person_id I think that your
> solution is ok.
>
> Best Regards
> Joan
>
>
> Filip Hanik escribió en mensaje ...
> >Hi,
> >
> >I have, ever since I learned SQL, been kind of confused by the GROUP BY
> >clause.
> >I have successfully used it for computing values.
> >
> >But here's my problem,
> >I want to retrieve two columns out of a table PERSON_ID, COMPANY_ID
> >but I'm only interested in retrieving on person per company.
> >
> >TABLE tblEmployees (
> > PERSON_ID INTEGER NOT NULL,
> > COMPANY_ID INTEGER NOT NULL
> >)
> >
> >
> >So I would like to group by COMPANY_ID but the compiler doesn't let me
> >retrieve the PERSON_ID.
> >
> >If I put a MAX around PERSON_ID will I get a correct person_id like this?
> >SELECT MAX(PERSON_ID), COMPANY_ID FROM tblEmployees GROUP BY COMPANY_ID;
> >
> >thanks
> >
> >Filip
> >fhanik_at_digitalworkforce.net
> >
> >
> >
>
>
Received on Fri Jul 02 1999 - 11:00:16 CDT

Original text of this message

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