2015-02-24 84 views
0

我有兩個表,比如Table1和Table2。 表1包含20個文件夾,主鍵ID爲Table1自動增量,Table2包含相同的20列,主鍵ID1爲TAble2自動增量。表1-ID,第1列,第2列,第3列...,第20列。 Table2-ID1,ID,Column1,Column2,......,Column20 I insert each record into Table1.I want to check duplicate Entry for Table1 if all field are same. Table2包含Entry表格Table1。 If I modified record First record goes to Table2 as it is then it will update into Table1.(i.e first copy the record into Table2 for backup and then update into Table1)因此,對於Table2附近的重複條目檢查也需要相同的條件。請幫忙! 我已經在php中編碼。避免在mysql中重複輸入

+1

某些代碼,表格DDL,示例數據和預期結果可能有所幫助。 – 2015-02-24 09:20:19

+0

好的,我會編輯並給表列確定。 – Pratiksha 2015-02-24 09:21:16

+0

你應該接受你以前的答案,如果這有助於你... – SMA 2015-02-24 09:22:03

回答

0

您可以爲每個插入事件從表2複製數據的表1寫入觸發器。

而對於獨特的數據,您可以在插入之前在php端檢查它,或者您可以將列定義爲唯一。你的問題有點混亂,所以很難給出確切的答案。

什麼是獨特的列?