Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning an Incremental Field Value in SQL
Message
 
À
30/04/2004 09:07:17
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00899694
Message ID:
00899717
Vues:
17
This message has been marked as the solution to the initial question of the thread.
Try this:

sele ... group by ... into cursor yy readwrite
repl all uniqueid with recn()

>That worked great, except (and I should have had this in my posted SQL)...
>
>I'm also using a GROUP BY clause which then causes all the UniqueID values to be the same.
>
>>Try this:
>>
>>....
>>   RECNO() AS UniqueID ;
>>....
>>
>>
>>>I'm trying to return 1 for the value of the UniqueID field in the first record and then increment each subsequent record in MyCursor. The SQL below returns all "1" in the resulting records. I'm sure this is because the pointer does not move in MyTable, but there must be a simple way. I was lookng at AutoInc, but that doesn't seem to be applicable to cursors. We have a GetNext functionality for tables but I don't need it here. I'm sure it's simple, but it's not coming to me right now.
>>>
>>>
>>>SELECT ;
>>>   MyTable.Field1, ;
>>>   RECNO('MyTable') AS UniqueID ;
>>>   FROM MyTable ;
>>>   INTO CURSOR MyCursor
>>>
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform