假设我在 mysql 中有这样的表:
userid, paymentid, datetime
blah, 123, 1/2/2011
blah, 144, 1/8/2011
foo, 151, 2/4/2011
bar, 178, 2,8,2011
如何添加一个“订单”列,它基本上是每个用户的序列计数,按日期时间排序?
userid, paymentid, datetime, order
blah, 123, 1/2/2011, 1
blah, 144, 1/8/2011, 2
foo, 151, 2/4/2011, 1
bar, 178, 2,8,2011, 1