On 13 Jun 2003 at 4:02, gamin wrote:

> To each colorID you assign a unique prime number (maintain this in a
> table). For each itemID now you have a unique colorPRODUCT (product of
> the prime numbers coressponding the various colorIDs for this itemID).
> To add a colorID to an itemID simply muliply the new prime
> (coressponding to the colorID being added) to the old colorPRODUCT. In
> the same way to remove a colorID devide colorPRODUCT by the
> corressponding prime. And to find the itemID which has a particular
> set of colors just check for the colorPRODUCT.

A more normal way, which wouldn't require such large numbers or the 
complication of factoring, would be to assign powers of 2 to the 
colors and add them rather than multiplying them.  Or you could use 
the SET column type in MySQL, which handles the powers of 2 behind 
the scenes:

   http://www.mysql.com/doc/en/SET.html


-- 
Keith C. Ivey <[EMAIL PROTECTED]>
Tobacco Documents Online
http://tobaccodocuments.org


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to