query result that depends on the count of matching field contents in one record

Ivan Smahin IvanSmahin at public.kherson.ua
Sat May 7 02:09:12 CDT 2005


Hello Ralf,

Saturday, May 7, 2005, 1:28:10 AM, you wrote:

RS> Hi,

RS> I want to create a search where I get a result that depends on the
RS> count matching field contents in one record. But I can't get it. May
RS> be, I am thinking in the wrong direction.
RS> Lets assume, I have a table with 4 fields (vshort). Now I want to get
RS> all records where more than 2 field matches a condition.

Sorry for prev. post. Just misreading some parts.

So - "WHERE" clause is predicate which is applied for each
"candidate" record. If it calculates true - record would be included to the
result.

You want to have some condition like - "at least 3 fields matches..."
It sounds very strange. I can't imagine what it can be for.

But, actually you need to enumerate ALL field-triads in "where" clause
in such a way:


WHERE
     ( f1 = ... AND f2 = ... AND f3 = ... )
     OR ( f1 = ... AND f2 = ... AND f4 = ... )
     OR ( f1 = ... AND f3 = ... AND f4 = ... )
     OR ( f2 = ... AND f3 = ... AND f4 = ... )




-- 
Best regards,
 Ivan                            mailto:IvanSmahin at public.kherson.ua



More information about the Valentina mailing list