Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Table Update
Message
De
25/05/2008 04:18:06
 
 
À
25/05/2008 02:32:43
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:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01319401
Message ID:
01319408
Vues:
13
This message has been marked as the solution to the initial question of the thread.
>Dear Sergey
>
>If table is as
>
>insert into table1 values ('1401',0)
>insert into table1 values ('1401007',0)
>insert into table1 values ('1401010',0)
>insert into table1 values ('1401025',0)
>insert into table1 values ('1402',1)
>insert into table1 values ('1402088',0)
>insert into table1 values ('1402101',0)
>insert into table1 values ('1402225',0)
>insert into table1 values ('1403',0)
>insert into table1 values ('1403088',0)
>insert into table1 values ('1403101',0)
>insert into table1 values ('1403225',0)
>
>Please imagine in tbale qty of 1402 is 1
>
>How to make qty=1 against all codes begins with 1402
>
>I do not use 1402 in procedure, the procudure must automatically detect qty=1 against any code begins with four character length.

Does this one do what you want?:
UPDATE table1 ;
	SET qty = 1 ;
	WHERE ;
		LEN(TRIM(code)) > 4 ;
		AND LEFT(code,4) in ( ;
			Select code ;
				From table1 ;
				WHERE qty = 1 AND LEN(TRIM(code)) = 4 ;
				)
hth
-Stefan
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform