Information générale
Catégorie:
Codage, syntaxe et commandes
Morning,
The result of that SQL will be:
Admin 00001 32334
EDP 10000 10005
I think it can only be done by looping the table instead of a single SQL because:
1. The name group is not unique.
2. The item range of a "name" can be in another group e.g. EDP 10000
And there is no way to sort out the table in the orginal order. That's why it won't work by SQL.
:) Wilfred
>The trick here is to set the decimals correctly so the output is formatted as you expect. Here is the code:
>
>LOCAL lCurrentDec
>lCurrentDec=SET("Decimals")
>SET DECIMALS TO 0
>SELECT name,PADL(MIN(VAL(item)),5,"0") as "Start", ;
> PADL(MAX(VAL(item)),5,"0") as "End" ;
> FROM MyTable ;
> GROUP BY name ;
> into CURSOR curMyTable
>SET DECIMALS TO &lCurrentDec
>
>>Hello all
>>
>>I have the data in following order
>>
>>Name Item
>>---- ----
>>
>>Admin 00001
>>Admin 00003
>>Admin 10004
>>Admin 10040
>>EDP 10000
>>EDP 10002
>>EDP 10005
>>Admin 21222
>>Admin 23233
>>Admin 32334
>>
>>How to get the result in this order
>>
>>Name Start End
>>-----------------------------
>>Admin 00001 10040
>>EDP 10000 10005
>>Admin 21222 32334
>>
>>Txs
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement