Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Count probleme
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01237077
Message ID:
01237580
Views:
15
Hi Bernhart,

You're welcome.

>
>Wonderfull !
>
>A big thank....sergey
>
>
>bernhart
>
>>Hi Bernhart,
>>
>>Your data doesn't have record order info in it which makes it impossible to achive what you want with UPDATE-SQL command. If you add column that defines data order than it becames simple
>>
>>CREATE CURSOR CmdMedic ( pk I autoinc, cNom C(20) , nGroup I )
>>INSERT INTO CmdMedic ( cNom ) VALUES ( 'Temesta 2.5' )  	&& I want 1 For ngroup
>>INSERT INTO CmdMedic ( cNom ) VALUES ( 'Aspirine' ) 		&& I want 1 For ngroup
>>INSERT INTO CmdMedic ( cNom ) VALUES ( 'Temesta 2.5' ) 		&& I want 2 For ngroup
>>INSERT INTO CmdMedic ( cNom ) VALUES ( 'Fluimycyl' ) 		&& I want 1 For ngroup
>>INSERT INTO CmdMedic ( cNom ) VALUES ( 'Rofenid' )			&& I want 1 For ngroup
>>INSERT INTO CmdMedic ( cNom ) VALUES ( 'Temesta 2.5' )		&& I want 3 For ngroup
>>
>>UPDATE CmdMedic SET nGroup = (SELECT COUNT(*) FROM CmdMedic cm2 ;
>>		WHERE cm2.cNom = CmdMedic.cNom AND cm2.pk < CmdMedic.pk) + 1
>>
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform