I have  data coming into the database from various sources.
Some  of these data may be duplicated, except that there is a field
noting the data source they are coming from. I do not wish them to appear
twice, but I do wish to make a note that these records were seen in two or more
sources. As I understand a UNIQUE INDEX will just filter out the double entries.
What I really want to say is:

IF INDEX(field1,field2,field3,...,fieldN) is seen, then do not insert this
record,  but in the existing record, UPDATe field N+1 to whatever it is
 plus the string ",field0"

Example:

field0  filed1 field2    field3    field4
172.16.166.1  10      trans1
already exists
and we see a record
172.16.166.2   10     trans1

then UPDATE the excisting record to
172.16.166.1  10 trans    ,172.16.166.2

I suspect this cannot be done in SQL,
 so maybe  I need to try via say DBI do an  INSERT and if it fails
then  do the update. But I guess I need to look at failure codes
 then to make sure this is tthe problem indeed.

Is there maybe a cleaner way??

Thanks, S.Alexiou



---------------------------------------------------------------------
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