[SOLVED] Â 1 Primary Key - Another not unique |
9/22/2018 7:46:52 AM |
PHPRunner General questions | |
lefty author
I have a customer file that I import to project each month . I am now using 9.8 and in the future 10.0 which should check for existing records and either update or add new records according to the manual if using a primary key in file. My older project was 9.7 I just truncated table and uploaded a new Customer file, Which I do not want to do anymore due to google map fields which I have to do geocoding every time I import a new file. So I made CustomerID the primary key instead of auto_number . Fine. Only problem is there are several CustomerID's that have EmployeesID's connected to the same Customer ( hence 3 records of CustomerID ) so it can't be the primary key. So I want to use a second key EmployeeID / or non unique field in the table mysql to import . My table looks something like this |
|
H
|
headingwest 9/22/2018 |
Hi John, |
lefty author 9/22/2018 | |
Hi John, Whats the error (getting syntax error in query wizard) If you download and use HeidiSQL it might be easier to see your keys. You'd have to make sure that you delete the original CustomerID key if that's blocking import because it's no longer unique. Sometimes I just throw in an extra key column if that's what's needed. Eg: recordid (unique, autoincrement) customerid Employeeid This allows multiple employee/customer records. You can add a unique constraint on customer/employee - unless say your doing "hoursworked" in which case there might be multiple Jim.
|