Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ordering on UNION
Message
De
27/03/2016 04:40:24
Walter Meester
HoogkarspelPays-Bas
 
 
À
26/03/2016 20:31:25
Information générale
Forum:
ASP.NET
Catégorie:
Bases de données
Versions des environnements
Environment:
VB 9.0
OS:
Windows 8.1
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01633812
Message ID:
01633821
Vues:
52
Michel,
SELECT * FROM 
   (SELECT TOP 10 * FROM A ORDER BY MyField
   UNION ALL
   SELECT TOP 10 * FROM B ORDER BY AnotherField) as x
ORDER BY CommonField
>I have a select including a UNION, so to join records from two different results.
>
>If I execute each select individually, this works ok on the order.
>
>When they are combined in the UNION, the order is completed mixed up.
>
>Are there any specific guidelines I would need to watch for when doing that?
>
>I have done that before and never saw such reaction. When I execute the same command in SSMS, I do not have the problem. So, it is somekind of relation when being executed with the SQL Client data provider.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform