我现在有组数据,类似
stockcode | time | price |
000001 | 2007 | 15 |
000001 | 2006 | 16 |
000001 | 2005 | 17 |
000002 | 2007 | 18 |
000002 | 2006 | 19 |
000002 | 2005 | 20 |
000003 | 2007 | 21 |
000003 | 2006 | 22 |
000003 | 2005 | 23 |
000004 | 2007 | 24 |
000004 | 2006 | 25 |
000004 | 2005 | 26 |
000005 | 2007 | 27 |
000005 | 2006 | 28 |
000005 | 2005 | 29 |
想做出以下这种格式,请问该如何编写语言呢,求教论坛里的高手解答,谢谢!
stockcode | time | price | lagprice |
000001 | 2007 | 15 | |
000001 | 2006 | 16 | 15 |
000001 | 2005 | 17 | 16 |
000002 | 2007 | 18 | |
000002 | 2006 | 19 | 18 |
000002 | 2005 | 20 | 19 |
000003 | 2007 | 21 | |
000003 | 2006 | 22 | 21 |
000003 | 2005 | 23 | 22 |
000004 | 2007 | 24 | |
000004 | 2006 | 25 | 24 |
000004 | 2005 | 26 | 25 |
000005 | 2007 | 27 | |
000005 | 2006 | 28 | 27 |
000005 | 2005 | 29 | 28 |