Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Checking if more than 0 rows exist.
"abc" <abc_at_hotmail.com> wrote:
> All,
>
> Kind of a new person here and this may be a stupid question but.
>
> We have a table with 20 columns and many millions of records. I need to
> check if the combination of 5 of those columns exists anywhere in the
> table. It does not matter how many times it exists in the table but only
> if the combination exists in the table.
>
> Select count(*) from combo_table where all fields match would count them
> all but all I really need to know is if any exist (>0 rows).
>
> The fields are indexed so what I am wondering is what is the most
> efficient way to check that criteria? Any suggestions?
select whatever from combo_table where foo=? and bar=? and baz=? and and baz2=? and baz3=? and rownum=1
-- -------------------- http://NewsReader.Com/ -------------------- Usenet Newsgroup Service $9.95/Month 30GBReceived on Mon May 09 2005 - 15:10:32 CDT
![]() |
![]() |