Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql order by
Message
De
11/12/2006 07:45:43
 
 
À
11/12/2006 07:44:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
SAMBA Server
Database:
Visual FoxPro
Divers
Thread ID:
01176457
Message ID:
01176494
Vues:
7
>>>>i want to create a sql statement for character field with index.
>>>>
>>>>sele accode, billdate, billno, amt from xcash2 group by accode, billno into curs ccust order by billdate,billno
>>>>
>>>>billno is a character field.
>>>>
>>>>this showing billnos
>>>>1
>>>>10
>>>>11
>>>>12
>>>>13
>>>>14
>>>>15
>>>>16
>>>>17
>>>>18
>>>>19
>>>>2
>>>>20
>>>>21
>>>>
>>>>but i want to see like :
>>>>1
>>>>2
>>>>3
>>>>4
>>>>5
>>>>6
>>>>
>>>>
>>>>warm regards,
>>>>mk.
>>>
>>>
>>>SELECT *, PADL(ALLTRIM(billno),6,[0]) AS OrdBy FROM ..... ORDER BY OrdBy
>>>
>>
>>Hi BB
>>
>>Wouldn't that still be in the same order - OrdBy still being char data?
>>I bow to you superior SQL knowledge, but I would have used:
>>
>>SELECT *, FROM ..... ORDER BY OrdBy
>>
>>Terry
>
>No, because this char field is left-padded with [0], you have:
>[00001]
>[00002]
>[00003]
>...
>in OrdBy field.

Ah yes, but wouldn't VAL( BillNo) AS OrdBy work just as well?
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform