The problem is that I can't produce a canonical representation of the
entries in my database. Often times some entries are subsets of others, but
considered equal. It's possible for an entry to be a subset of two larger
entries that aren't equal themselves and still be equal to each of the
larger entries.

On 9/28/06, Igor Tandetnik <[EMAIL PROTECTED]> wrote:

Ron Stevens <sqlite-Y9FGH9USQxS1Z/[EMAIL PROTECTED]> wrote:
> I have a custom function that compares two text values and returns 1
> if they're equal based on an algorithm that's not strictly text
> comparison and 0 if they don't match. I want to do a query that
> groups all rows that match using my custom function into a single
> group. Is that possible?

What you really need is a custom function that produces a "canonical
representation" for all the strings in the same equivalence class under
your equivalence relation. That is, a function CR(s) such as for every
s1 and s2, s1 ~ s2 if and only if CR(s1) = CR(s2). Here '~' is your
equivalence relation, '=' is the usual byte-wise comparison. E.g. if '~'
is a case-insensitive comparison, then CR(s) could return s converted to
all lowercase (or all uppercase).

Once you have such a function, you can simply GROUP BY CR(fieldName).

Igor Tandetnik



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]

-----------------------------------------------------------------------------


Reply via email to