答案 0 :(得分:1)
如果您所使用的版本支持LEAD
,则可以使用select customer,orderdate,item,
lead(orderdate,1) over(partition by customer order by date) as second_date,
lead(item,1) over(partition by customer order by date) as second_item,
lead(orderdate,2) over(partition by customer order by date) as third_date,
lead(item,2) over(partition by customer order by date) as third_item
from tbl
执行此操作。
enter code here
<tr class="clickable-row">
<td colspan="3"><strong><a href="/mathdept.ucr.edu">CENTER FOR MATHEMATICAL & COMPUTATIONAL MODELING IN BIOLOGY & MEDICINE<span style="float: right;">►►</span></a><br /></strong></td>
</tr>