开发者

sql query for modifications

开发者 https://www.devze.com 2023-03-16 23:48 出处:网络
I have a table with data like this: EmpIDkeyvaluePair 11111-1-4.JPG 24434-4-6.JPG 390899-4-3.JPG 48956-1-1.JPG

I have a table with data like this:

 EmpID   keyvaluePair
 1       1111-1-4.JPG
 2       4434-4-6.JPG 
 3       90899-4-3.JPG 
 4       8956-1-1.JPG 
 5      开发者_Python百科 67827-9-5.JPG 

Now I need to modify the above table data and insert data into another table.

Here the value is nothing but the end value in keyvaluepair column:

ID    Value
1     4
2     6
3     3
4     1
5     5

Hope my question is clear.

Can you help me out how to write a query to do the above operations

Thanks

Happysmile.


insert into SecondTable (ID, Value)
select EmpID, right(keyvaluePair,1) from FirstTable


INSERT INTO NewTable(ID, Value)
SELECT EmpID, right(keyvaluePair,1) FROM OldTable
0

精彩评论

暂无评论...
验证码 换一张
取 消