RE: rewrite group by query

2004-01-06 Thread Rohan Karanjawala
try this out select a, b from (select a from tab1 group by a having count(*)=1) alias where a in alias; regds, Rohan From: elain he [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: Multiple recipients of list ORACLE-L [EMAIL PROTECTED] Subject: rewrite group by query Date: Mon, 05 Jan 2004 07

rewrite group by query

2004-01-05 Thread elain he
Hi, Does anyone have a better way of rewriting the following query? I'm trying to avoid querying the table, tab1 twice. select a, b from tab1 where a in (select a from tab1 group by a having count(*)=1); Thanks. elain _ Make your

Re: rewrite group by query

2004-01-05 Thread Boris Dali
How about select * from (select tab1.*, count(a) over(partition by a) a_count from tab1) where a_count =1; ... would probably save you one pass over tab1. Thanks, Boris Dali. --- elain he [EMAIL PROTECTED] wrote: Hi, Does anyone have a better way of rewriting the following query? I'm