确定次序的问题
如下表:
SeqNo OrderNo PO ShipDate Packing ShipMode
NULL 105800A 1591872 2010-12-15 bul By Sea
NULL 105800A 2587254 2010-12-8 pre By Sea
NULL 105800A 2587254 2010-12-8 bul By Sea
NULL 105800A 2587256 2010-12-8 bul By Sea
NULL 105800A 2587256 2010-12-8 pre By Sea
NULL 105800A 2589381 2010-12-8 gbu By Air
NULL 105800A 2589836 2010-12-8 gbu By Air
NULL 105800A 2590725 2010-11-24 bul By Air
NULL 105800A 2590725 2010-12-1 bul By Air
NULL 105800A 2590725 2010-12-1 bul By Sea
希望达到如下要求:
同一个OrderNo,PO之下,如果ShipDate有几个的话,按照时间排序,Packing是pre优先于bul,ShipMode是By Air的优先于By Sea,更新SeqNo列,这里是Int类型。
到了第二个ShipDate,仍然是刚才的规则,更新SeqNo列,不过数值要比上一个ShipDate大一。比如:
SeqNo OrderNo PO ShipDate Packing ShipMode
1 105800A 1591872 2010-12-15 bul By Sea
1 105800A 2587254 2010-12-8 pre By Sea
2 105800A 2587254 2010-12-8 bul By Sea
2 105800A 2587256 2010-12-8 bul By Sea
1 105800A 2587256 2010-12-8 pre By Sea
1 105800A 2589381 2010-12-8 gbu By Air
1 105800A 2589836 2010-12-8 gbu By Air
1 105800A 2590725 2010-11-24 bul By Air
2 105800A 2590725 2010-12-1 bul By Air
3 105800A 2590725 2010-12-1 bul By Sea
请各位不吝赐教,SQL2000,拜托了!