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 -> can I put a Select in my Select?

can I put a Select in my Select?

From: Mike Cohen <mcohen_at_attbi.com>
Date: 5 Feb 2003 15:25:21 -0800
Message-ID: <9a742dd3.0302051525.24e11ef5@posting.google.com>


Hello,

I was wondering if I can nest a Select statement within my Select statement?

Thank you very much!

Mike

The code I'm trying to get work is as such:

SELECT
rcm.MSA,
count(ttt.transaction_id),
sum(ttt.SALE_PRICE),
round((select

         sum(ttt3.SALE_PRICE)
       from
	 t_transaction ttt3
	 t_seller tsp3
       where 
	 ttt3.close_ts != 0
	 and tsp3.create_ts > 1004601600  
	 and tsp3.create_ts < 1038733200
	 and tsp3.id=ttt3.id
       )
     /
        (select 
	   count(ttt2.transaction_id)
         from 
	   t_transaction ttt2,
	   t_seller tsp2
	 where 
	   ttt2.d_actual_close_ts != 0
           and tsp2.create_ts > 1004601600  
	   and tsp2.create_ts < 1038733200
	   and tsp2.id=ttt2.id
         )
     ) "AVERAGE"

FROM
claritas_mhv rcm,
t_seller tsp,
t_transaction ttt
WHERE
ttt.status in (600,700)
and ttt.property = 'S'
and tsp.create_ts > 1004601600  /* 11.1.01 */
and tsp.create_ts < 1038733200  /* 11.1.02 */
and rcm.msa is not null
and rcm.zip_code=tsp.ZIP_CODE
and tsp.id=ttt.id

GROUP BY
rcm.MSA Received on Wed Feb 05 2003 - 17:25:21 CST

Original text of this message

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