Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Union and order by and primary key w/identity
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00539167
Message ID:
00539171
Vues:
16
This message has been marked as the solution to the initial question of the thread.
Terry,

It has nothing to do with identity field.
According to BOL, there can be only one ORDER BY clause per statement at the very end of it
select * from trnhead where shipped=0
union all
select * from ordhead where shipped=0 order by id
>id field is primary key w/1 increment identity on that field as well.
>
>I can do:
>select * from trnhead where shipped=0 order by id
>fine.
>
>but:
>select * from trnhead where shipped=0 order by id
>union all
>select * from ordhead where shipped=0 order by id
>won't work with the order bys in there.
>
>I just took the order bys out since the ordering is okay it seems without, but:
>
>Does anyone know why?
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform