|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Dear List,
Could someone point me toward a solution to this update? I have a table that might have duplicate values in the field p_h. I would like to use an update to set another column in that table, columnn a_f, to a value of of 'c' for all _but_one_ of the records within every set of duplicates. In other words, after the update, all records but one within a set that have duplicate values in p_h should have field a_f set to 'c'. I don't care which of the duplicates get marked, I just need to have one and only one of the duplicates left unmarked after the update. I hope that is clear. Thanks! |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
Bob Smither wrote:
> Dear List, > > Could someone point me toward a solution to this update? I have a > table that might have duplicate values in the field p_h. I would > like to use an update to set another column in that table, columnn > a_f, to a value of of 'c' for all _but_one_ of the records within > every set of duplicates. > > In other words, after the update, all records but one within a set > that have duplicate values in p_h should have field a_f set to 'c'. > > I don't care which of the duplicates get marked, I just need to have > one and only one of the duplicates left unmarked after the update. > > I hope that is clear. > > Thanks! I would set all rows so that a_f = 'c', then use the strawberry query to reset only the first/last record of a set to blank. http://dev.mysql.com/doc/refman/5.0/...group-row.html |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Wed, 02 Jan 2008 15:36:40 -0600, Bob Smither
<smither78@comcast.net> wrote: >Dear List, > >Could someone point me toward a solution to this update? I have a table >that might have duplicate values in the field p_h. I would like to use >an update to set another column in that table, columnn a_f, to a value of >of 'c' for all _but_one_ of the records within every set of duplicates. > >In other words, after the update, all records but one within a set that >have duplicate values in p_h should have field a_f set to 'c'. > >I don't care which of the duplicates get marked, I just need to have one >and only one of the duplicates left unmarked after the update. > >I hope that is clear. > >Thanks! Does your table have a primary key? -- ( Kees ) c[_] Esistono due tipi di persone: quelle intelligenti e quelle che non lo sono. Con le prime, non si arriva a questionare, con le altre, e` inutile farlo... (#94) |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
On Wed, 02 Jan 2008 23:26:56 +0100, Kees Nuyt wrote:
> On Wed, 02 Jan 2008 15:36:40 -0600, Bob Smither <smither78@comcast.net> > wrote: > >>Dear List, >> >>Could someone point me toward a solution to this update? I have a table >>that might have duplicate values in the field p_h. I would like to use >>an update to set another column in that table, columnn a_f, to a value >>of of 'c' for all _but_one_ of the records within every set of >>duplicates. >> >>In other words, after the update, all records but one within a set that >>have duplicate values in p_h should have field a_f set to 'c'. >> >>I don't care which of the duplicates get marked, I just need to have one >>and only one of the duplicates left unmarked after the update. >> >>I hope that is clear. >> >>Thanks! > > Does your table have a primary key? Yes it does. |
|
![]() |
| Outils de la discussion | |
|
|