Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Odd SQL ORDER BY Behavior
Message
 
À
03/08/2000 18:06:20
Cindy Winegarden
Duke University Medical Center
Durham, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00400758
Message ID:
00401368
Vues:
24
ORDER BY 1, 2 is taking the _original_ values in your Dummy cursor at the time is trying to order your resulting set.

You can force VFP to take the itermediate values by referencing the column by name (MyField) instead of doing it by position.

Try this:
SELECT Rec, ;
    PADR(ALLT(MyField) + IIF(Rec = 3, " - PBMTU", ""), 50) ;
    AS MyField ;
    FROM Dummy ;
    ORDER BY MyField, 2
>Can anyone explain why this does not put the record with "PBMTU" (Pediatric Bone Marrow Transplant Unit) in the last position?
>
>It's for an internal report and really doesn't matter, except that I'm really surprised it comes out in this order.
>
>
>CREATE CURSOR Dummy (Rec N(1), MyField C(60))
>INSERT INTO Dummy (Rec, MyField) VALUES ;
>    (1, "CLINICAL ASSOCIATE - Nurse Practitioner")
>INSERT INTO Dummy (Rec, MyField) VALUES ;
>    (2, "CLINICAL ASSOCIATE - Nurse Practitioner")
>INSERT INTO Dummy (Rec, MyField) VALUES ;
>    (3, "CLINICAL ASSOCIATE - Nurse Practitioner")
>INSERT INTO Dummy (Rec, MyField) VALUES ;
>    (4, "CLINICAL ASSOCIATE - Nurse Practitioner")
>INSERT INTO Dummy (Rec, MyField) VALUES ;
>    (5, "CLINICAL ASSOCIATE - Nurse Practitioner")
>INSERT INTO Dummy (Rec, MyField) VALUES ;
>    (6, "CLINICAL ASSOCIATE - Nurse Practitioner")
>
>SELECT Rec, ;
>    PADR(ALLT(MyField) + IIF(Rec = 3, " - PBMTU", ""), 50) ;
>    AS MyField ;
>    FROM Dummy ;
>    ORDER BY 1, 2
>
Hector Correa
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform