Re: Specify exact number in where clause list
Date: Wed, 6 Feb 2002 13:54:03 +0100
Message-ID: <a3r924$r17$1_at_oslo-nntp.eunet.no>
Steve Sorden <steve_at_sorden.com> wrote in message
news:785857.0202051646.5f77f8e4_at_posting.google.com...
> Is there a way to specify an exact number of any combination in a
> list?
>
> For example I would like to say something like:
>
> select * from table_name
> where match_item in ('one','two','three','four');
>
> but I want to be able to say, "Where any three of the four are
> matched."
> or "Where any two of the four are matched."
>
> The key is that I have to be able to specify exactly how many matches;
> no more, no less.
Just an idea, I dont know if it's suitable for your needs but...
Maybee you could write a function that takes the coulmns and matching criteria as arguments and return the number of matches ?
Select * from table_name
where 3 = matchfunction ( table_name.c1, 'one',
table_name.c2,'two', etc.. )
Not really suited for ad-hoc queries though.
-- Jon Håvard GrøtterudReceived on Wed Feb 06 2002 - 13:54:03 CET