MySQL Forums
Forum List  »  Knowledge Base

adding new data to a table with sequential data
Posted by: Thor Tryggvason
Date: January 25, 2010 08:28PM

I am trying to enter data into a table that has semi-sequential data in it.

Example of data in table customers:
phone ; Name ; number
292-123-4567; John Doe ; "null"
292-123-4567; Granny Smith ; 1
292-123-4567; Jane Doe ; 2
345-567-1234; Peter Doe ; "null"
456-567-2345; Pete Doe ; "null"

In other words, if there are more than one name registered on any phone number, the sequence number should increase by 1 on insert of new row.

Then I have a table import with customer data containing e.g.:
292-123-4567; Grandpa Smith
678-123-4567; Jane Doe

The first row should be inserted and get a sequence number "3"
The second row should only be inserted into customers with sequence number "null".
There are hundreds of rows that need to be inserted every week.

Any suggestions on how to do this? I am totally lost.


Options: ReplyQuote

Written By
adding new data to a table with sequential data
January 25, 2010 08:28PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.