Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Puzzler
Message
De
05/02/2005 04:09:16
 
 
À
04/02/2005 15:52:42
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Divers
Thread ID:
00983656
Message ID:
00984147
Vues:
29
>Hi Fabio,
>
>Thanks for replying.
>
>>Info are insufficient ( PKEY(EnrollmentSchool2) IS ? Assume: ISMId):
>
>The PK for EnrollmentSchool2 is ENRid.
>
Ok.

But , EnrollmentSchool2.ENRid is not used in Update,
and then, without a surrogate primary key, ( EnrollmentSchool2.ISMId is not unique ),
you cannot do this with a single update ( of course, without triggers ).

This, because with the check HAVING NOT IN exclude the MIN(enr.EnrId)
that exists in EnrollmentSchool2 before the UPDATE run,
but the SET can assign the same MIN(enr.EnrId) to 2 EnrollmentSchool2
different rows ( 2 different EnrollmentSchool2.ENRid ).

Then, you have to found a row by row correlate expression
between the updated EnrollmentSchool2 table and the SELECT min() subquery.

Fabio
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform