Better way (more efficient) to find existance of row

  • From: "Lyall Barbour" <lyallbarbour@xxxxxxxxxxxxxxx>
  • To: oracle-l <oracle-l@xxxxxxxxxxxxx>
  • Date: Tue, 21 May 2013 10:26:27 -0400

Hello,
 I'm trying to find out if there's a better/faster way to find the existence of 
a row.
The vendor has this query:
select 'Y' from <table> c where c.<col1> = a.<col1> and rownum = 1
I made this query:
select 'Y' from <table> c where c.<col1> = a.<col1> group by a.<col1> having 
count(a.<col1>) >= 1
I feel like there's a better way. FYI a. table alias is from the outer FROM 
clause.
Thanks!
Lyall Barbour

--
//www.freelists.org/webpage/oracle-l


Other related posts: