I'm not even sure if this is possible. I am using Kohana framework(ver 2.3). I have 2 separate databases. One called 'employees' and another called 'tracker'. The databases are used in 2 different websites. I want to eliminate a table in the tracker database called 'csr', which contains identical employee data, and link the tracker to the employee info in the employees database.
In my tracker application I have a model setup for employees which references the external 'employees' database. I can query it with ORM from the tracker application and all is well. the unique key for employees is 'id'.
In my tracker database I have a model for 'records' table with about 12k entries. None of the field names correspond to any field names in the employees table from the employees database but some fields do contain identical information. The unique key for 'records' is Transaction_Number
Please note I did not write this application or design the databases. I am trying to "retro-fit" the tracker application to use the, now centralized, employee data .
There are 9 fields in 'records' that contain matching information in the employees database. This 9 fields contain employee id's and names but are not all the same id.
I can change the data in these 9 fields so that they are all employee id's if it would help but I need to be able to get employee data: names, addresses, etc., based on the id in any of those 9 fields
Redesigning the database would cause a rewrite of the tracker application and I really don't have the time to do all that.
To save some reading, I am not including the table structures here but I can add them if needed.
What can I do to link these two tables together?
EDIT: Added table structure for tracker.records
TRACKER.RECORDS
Transaction_Number (PK AI not null)
date
accountnumber
reasoncode
reasondesc
actioncode
actiondesc
comments
supervisor - employee->id (supervisor that created the record)
supername - employee->name
supersuper - employee->parent->name
superman - employee->parent->parent->name
eid - employee->id (employee that the record is about)
Service_Rep - employee->name
ServRepSupervisor - employee->parent->name
ServRepManager - employee->parent->parent->name
csrfollow - employee->name (who to follow up with)
Important
Read
Followup_Read
followup_Important
the employee table is using ORM_Tree to be self relational.
I need to be able to get employee info for any of those fields. I can change the data in each of those fields to be an employee id and i think i can eliminate some of them. the only ones I rally need are supervisor(employee->id), eid(employee->id) and csrfollow(can be changed to employee->id). the other fields can be discovered based on the employee->id. I still need to have those 3 fields point to the employee.id field in the employees database.