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: SQL Plus Help

Re: SQL Plus Help

From: Anurag Varma <avdbi_at_hotmail.com>
Date: Thu, 10 Jun 2004 23:42:30 GMT
Message-ID: <Gl6yc.67361$j24.51062@twister.nyroc.rr.com>

"Ash" <ashok_settyvari_at_yahoo.com> wrote in message news:e7f2e36f.0406101338.5f8ca7d8_at_posting.google.com...
> Hello:
>
> Im a newbee to SQL. Here is an SQL statement and its result.
> 1* select ALAN8,ALEFTB,ALADD1,ALADD2,ALADD3,ALADD4,ALCTY1,ALADDS,ALADDZ
> from F0116,F0101 where ABAN8=ALAN8 AND abat1='C' and aban8='121'
> SQL> /
>
> ALAN8 ALEFTB ALADD1
> --------- --------- ----------------------------------------
> ALADD2 ALADD3
> ----------------------------------------
> ----------------------------------------
> ALADD4 ALCTY1 ALA
> ALADDZ
> ---------------------------------------- ------------------------- ---
> ------------
> 121 101298
> 120 BROADWAY
> NEW YORK NY
> 10271
>
> 121 102086
> 120 BROADWAY
> NEW YORK NY
> 10005
>
> 121 102127
> 120 BROADWAY
> NEW YORK NY
> 10271
>
> 121 102357
> 200 LIBERTY ST 22FLR 1 WORLD FINANCIAL CENTER
> NEW YORK NY
> 10281
>
>
>
> The thing, Im trying to get now is get the max value of aleftb column
> with a similar SQL statement. something like
>
> 1* select ALAN8,max(ALEFTB),ALADD1,ALADD2,ALADD3,ALADD4,ALCTY1,ALADDS,ALADDZ
> from F0116,F0101 where ABAN8=ALAN8 AND abat1='C' and aban8='121'
>
> When I use this, its giving me not a GROUP BY expression. Then I tried
> grouping the above statement like this.
>
> 1* select ALAN8,max(ALEFTB),ALADD1,ALADD2,ALADD3,ALADD4,ALCTY1,ALADDS,ALADDZ
> from F0116,F0101 where ABAN8=ALAN8 AND abat1='C' and aban8='121' group
> by alan8,aleftb;
>
> Again its giving me the same result, not a GROUP BY function.
>
> Can anyone please let me know, what all the columns I need to include
> in group by expression.
>
> Thanks a ton.
>
> Ash

Don't consider this as rude .. but:
Before you start pounding this newsgroup with newbee questions, please go get a book on basic SQL. Do some reading on Oracle Concepts at tahiti.oracle.com and try Googling before asking these questions.

An example of select with group by would be:

select col1, col2, max(col3)
from table1
where col4 = 'X'
group by col1, col2
/

Anurag Received on Thu Jun 10 2004 - 18:42:30 CDT

Original text of this message

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