Jump to content

how to insert more records in one unique id


gagards200

Recommended Posts

hello guyz..im just new in this forum, hope that you guyz can help me with my problem.....

 

i have a payroll database in which Employee_id is the primary key, i assign already an Employee_id for all the employees for this month, my problem is for the next month they will make a new transaction my syntax give them again a NEW Employee_id, what I want to happen is that their Employee_id that he took before was already their permanent Employee_id.

 

Any idea guys how to solve this, Im just new in this forum, your help is highly appreciated....

Link to comment
Share on other sites

reading your post seems that you have a database model design problem there....  looks like you at least need:

- An Employee table

- a Monthly transaction table which should be related to the employee table  (employee 1:n to transactions)

 

posting your table(s) definition will help to give you a better answer

Link to comment
Share on other sites

Thank you for your immediate reply.....it seems like this...

 

Employee Table

 

Employee_Id    Field2    Field3      Field4.......etc.

 

 

My Employee_Id is not auto increment, meaning i made it through randomize, when i will insert a record of course they will insert also Employee_Id, like 00000123....Now when I will insert again new record with the same data they will give me new Employee_Id, I want to save data to his Employee_Id created during first time he insert record.

 

Really I am not sure how to fixed it, so that when I will search by Employee_Id it will give me the history of his record.

 

If you have any idea how to make it please share it to me, thanks again and GOD BLESS....

Link to comment
Share on other sites

Hi

 

I agree with mikosiko. You should have a table of employees storing the common data for that employee with one record per employee. The emplyee id on this table can be generated using an auto increment (or randomly if you really must). Then have a 2nd table with its own auto increment key, with an index on the employee id and the data you need for that employee for that month.

 

All the best

 

Keitth

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.