Page 1 of 1
Duplicate Field
Posted: Mon Sep 29, 2014 6:54 pm
by nserpiot
Hi,
I have a problem discovering Duplicate rows in a table, that is not more general.
My site is being used in order to denote Shifts for Pharmacies and I do not want to insert the Same Shift for the Same Pharmacy (or at least to Overwrite previous entry).
I know that "check duplicate" option exists, but I can't figure out how to use it in my example. Since, I can have many entries for the same Pharmacy, but for different days and I can have many entries for the same Day , but for different Pharmacies.
Any ideas are welcome.
BR,
Nick
Re: Duplicate Field
Posted: Mon Sep 29, 2014 7:37 pm
by scs
Make Pharmacy_field
, day_field
, shift_field
, shift_time_field
as you PRIMARY KEY
Re: Duplicate Field
Posted: Mon Sep 29, 2014 8:08 pm
by nserpiot
If you mean to make all these fields Primary Keys in the PHPMAKER, I did it but did not prevent me from inserting entries for the same Pharmacy, same Time, same Shift ...
Re: Duplicate Field
Posted: Mon Sep 29, 2014 8:24 pm
by scs
Maybe you need to control all those key field is a standard format.
eg all fields are in lowercase or uppercase only.
Re: Duplicate Field
Posted: Mon Sep 29, 2014 8:29 pm
by nserpiot
Thank you scs. I had left another field in the Primary and that's why it was not working. Now, it's ok. But do you think it is better to have these keys configured as Primary in MYSQL level also ?
Re: Duplicate Field
Posted: Mon Sep 29, 2014 8:45 pm
by scs
Yes. Because you need UNIQUE time table for each pharmacy on each day by each shift (and so on) in your table.