I have the following table structure (in MySQL):
DocID, Code, IsDup, DopOf
, where DocID
is Unique.
Values are like :
1,AAAA,nul,nul 2,AAAA,nul,nul 3,AAAA,nul,nul 4,BBBB,nul,nul 5,CCCC,nul,nul 6,CCCC,nul,nul
What I want is to write a procedure which can update the table and give the desired result as:
1,AAAA,0,0 2,AAAA,1,1 3,AAAA,1,1 4,BBBB,0,0 5,CCCC,0,0 6,CCCC,1,5
IsDup
shows whether the Doc
is duplicate or not on the basis of Code
,
and DupOf
indicates the original DocId
.
Can anybody help me? I'm trying to implement the logic, but I'm stuck.
Your help would be highly appreciated.
Thanks.