I need to write SQL to update one of the description-2 column in table A.
Here is the scenario
Create table test
Suppose upcfld has value '3' and it has 4 rows with different data in fields. Is it possible to update desc2 based on following conditions? The conditions are :
* If all the fld1..fld4 are same for all rows then desc2 = desc1 of the row which has max(Id) - Simple one!!!
* If any of the fld1...fld4 are different for each row then desc2 = desc1 of each row.
* if fld1..fld4 are same for first two records then desc2 = desc1 of row which has max(ID), but if the third row matches with first then desc2 of third row = desc1 of row 1 and 2 whichever has max(id)
* And so on.......
Is it possible to construct this in SQL? Appreciate your reply!
Let me know if this is clear or need more explaination.
Click Here to Expand Forum to Full Width