Table 1
DataValue TokenIndex
AB NULL
TABLE 2
TokenIndex TokenValue
1 AB
2 ABAC
i want to update my table1 (TokenIndex) with the (TokenIndex) of table2 where table1 (DataValue) (sql LIKE) with (TokenValue)
TABLE 2 with longest string
EG. AB like like AB,and ABAC also but i want 'ABAC' TokenIndex (which is 2) to update in Token index of Table 1 against AB
i want retult
Table 1
DataValue TokenIndex
AB 2
Loading
Iftikar HussainPosted Jul 23, 2013, 2:35 AM
Try like this
Regards,
Iftikar
Ruchi HPosted Jul 23, 2013, 2:17 AM
You can use this query
Update Table1
Set TokenIndex=(
Select Table2.TokenIndex From Table2, Table1
Where TokenValue like [DataValue] || '_%'
)
for updating all the rows
sakshi goyalPosted May 10, 2013, 2:48 AM
where table2.TokenValue like 'AB%' and tokenvalue not like 'AB'
Arul ManivannanPosted Mar 21, 2013, 2:06 AM
Your result example seems to be more clearer than other explanations. But why did you want to update table1's record with Table2's Tokenindex = 2 and why not Tokenindex = 1. What is the pattern behind it. Solution is easy by tweaking update query but By clarifying this i only we can have proper solution.
Arul Manivannnan