On Thursday 29 November 2001 04:34, Jonathan Hilgeman wrote:
> I know this is a really simple thing that I'm just missing. Basically I
> want to store Apache logs in a mySQL database, in a table with 9 fields. I
> want each entry to be completely unique via all 9 fields. So, if fields 1-8
> in a new record are all identical to fields 1-8 in an existing record, but
> field 9 is different, then the new record should be insertable. The only
> time a record should come back with a duplicate entry error is if all 9
> fields are the same. How do I go about doing this?
>
> I tried a UNIQUE combination key of all 9 fields, but the key was too big
> and was limited to 500 in size. Thoughts anyone?

You can add another column the content of which will be the md5 hash of the 
concatenation of the original 9 columns. Whilst it does not guarantee 
absolute uniqueness it should be usable if you do not have too many rows to 
deal with.

hth
-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Baker's First Law of Federal Geometry:
        A block grant is a solid mass of money surrounded on all sides by
        governors.
*/

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to