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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: How to write a sql query

RE: How to write a sql query

From: Rooy van, Marco <Rooy_M_at_sfs.nl>
Date: Wed, 22 Nov 2000 13:21:34 +0100
Message-Id: <10688.122725@fatcity.com>


I would do it like

select t1.a1, t1.b1, t2.b1, t3.b1
  from (select a1, min(b1) as b1

          from test
         group by a1) t1,
       test t2,
       (select a1, max(b1) as b1
          from test
         group by a1) t3
  where t1.a1 = t2.a1
    and t1.a1 = t3.a1

    and t1.b1 < t2.b1
    and t3.b1 > t2.b1;

Best regards,

Marco

-----Oorspronkelijk bericht-----
Van: magesh [mailto:magesh_at_garoo.ne.jp]
Verzonden: woensdag 22 november 2000 12:30 Aan: Multiple recipients of list ORACLE-L Onderwerp: How to write a sql query

Hi All

   How to write a sql query to print the matrix report. Eg . Test table .

       a1    b1
        1     2.3
        1     3.5
        1     7.0
        2     1.7
        2     2.6
        2     2.9
        3     1.3
        3     2.9
        3     3.0


I need the output ,should be

     1           2.3      3.5     7.0
     2           1.7.     2.6     2.9
     3           1.3      2.9     3.0


Please , Any one suggest me how to write a sql query for this.

Thanks & Regards
Magesh

--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: magesh
  INET: magesh_at_garoo.ne.jp

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Wed Nov 22 2000 - 06:21:34 CST

Original text of this message

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