开发者

sql query for modifications

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜