PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > with Update
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
with Update

Réponse
 
LinkBack Outils de la discussion
Vieux 02/01/2008, 21h36   #1
Bob Smither
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut with Update

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!
  Réponse avec citation
Vieux 02/01/2008, 22h19   #2
Paul Lautman
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: with Update

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


  Réponse avec citation
Vieux 02/01/2008, 22h26   #3
Kees Nuyt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: with Update

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)
  Réponse avec citation
Vieux 02/01/2008, 23h10   #4
Bob Smither
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: with Update

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.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 14h51.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13036 seconds with 12 queries