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

Home -> Community -> Usenet -> c.d.o.server -> Re: Very long "WHERE" list.

Re: Very long "WHERE" list.

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Sun, 11 Jul 2004 13:52:19 -0700
Message-ID: <1089585354.851243@yasure>


Andy Hassall wrote:

> select count(*)
> from t
> where id in (1,3,5,7,9,11,13,15,17,19,21,23,25,27, [ snip, goes up to 20001 ]

> Andy Hassall <andy_at_andyh.co.uk> / Space: disk usage analysis tool
> http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space

I just got past the ridiculous nature of an IN list with 20,000 members and thought I'd throw this one out for those interested.

SELECT COUNT(*)
FROM t
WHERE MOD(id, 2) = 1;

Now what to do with the time saved by not having to type in that ridiculous list. I think I'll have a scotch and take the boat out.

Daniel Morgan Received on Sun Jul 11 2004 - 15:52:19 CDT

Original text of this message

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