Subj : Re: Generating an Index To : comp.programming From : Willem Date : Thu Sep 08 2005 10:32 pm Mary wrote: ) I was hoping that I could create a third column in the database that ) contained a "weighting" factor (or something like that) based on the ) "Data" column, so that when I sorted the table on this new column I ) would find records where the distance between them is lowest. Note that ) it's not as simple as counting up the 1's...eg: ) ) 101010101010 and ) 010101010101 ) Both have the same number of 1's, but the distance is 12, ie 100% ) different. If you view those numbers as coordinates in an N-dimensional space (where N is the number of binary digits) then each number is a corner of an N-dimensional hypercube. The distance is the number of edges between two points. That means that each point has a large number of 'neighbours', but all of them are in a different direction. What you want is to compress this into a 1-dimensional ordering. That's just not going to work. As an example, take a 10x10 grid, and order the points in that grid so that points that are close together in the grid are also close together in the ordering. There will be two points that are neighbours in the grid that are quite far apart in the ordering. And that's only going from two-D to one-D. SaSW, Willem -- Disclaimer: I am in no way responsible for any of the statements made in the above text. For all I know I might be drugged or something.. No I'm not paranoid. You all think I'm paranoid, don't you ! #EOT .