1

mysql format :

        jcid_no           die_no          qty
       jcid-085951         12345            2
       jcid-085951         12345            2

Friends I've a table format as the above , I'll be continuously inserting the values into the table but my requirement is I can insert n times same number of same jcid_no and die_no but not on the same row .

Valid example:

        jcid_no           die_no          qty
       jcid-085951         12345            2
       jcid-085951         54321            2


        jcid_no           die_no          qty
       jcid-085951         12345            2
       jcid-984301         12345            2

Same jcid_no different die_no and same die_no different jcid_no is ok but as if now my table got cluttered by have same table values multiple times my requirement is first I have to delete all the duplicate values that has been already inserted (i.e)

Wrong Format :

        jcid_no           die_no          qty
       jcid-085951         12345            2
       jcid-085951         12345            2

and the second thing is preventing this duplication for further enter , I use PHP as my front end .

1
  • select distinct into temp table. Delete. Copy back. Commented Nov 4, 2015 at 11:15

1 Answer 1

1

To avoid further faulty values try using combined primary key like

PRIMARY KEY (jcid_no, die_no)

To delete double values try it with self join delete.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.