Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Table Update
Message
From
25/05/2008 04:18:06
 
 
To
25/05/2008 02:32:43
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01319401
Message ID:
01319408
Views:
12
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
Previous
Reply
Map
View

Click here to load this message in the networking platform