t***@gmail.com
2012-04-12 13:37:42 UTC
hello,
one of our developers wanted to use a function natively in Informix that behaves like DB2's row_num function.
seq_num would be returned from the function (sequential between trailers).
In db2 it is row_number() over(partition by trailer order by trailer,tour_date).
sample data returned:
trailer# tour date location seq_num
123 2/1/2012 Ardmore 1
123 2/5/2012 P&G - Dallas 2
123 2/6/2012 Dallas 3
123 2/8/2012 Ardmore 4
456 2/1/2012 Ardmore 1
456 2/4/2012 Ardmore 2
456 2/10/2012 DGStore - Dallas 3
456 2/20/2012 Ardmore 4
the developer's comment :
"Comes in handy on the db2 side when creating from-to date ranges.
I am a little surprised it isn't in informix since all the other major db systems (db2, SAP, Oracle) have something similar."
i told him that it could be we are missing something and said i'd try to get feedback through post here.
thanks in advance - Tom
one of our developers wanted to use a function natively in Informix that behaves like DB2's row_num function.
seq_num would be returned from the function (sequential between trailers).
In db2 it is row_number() over(partition by trailer order by trailer,tour_date).
sample data returned:
trailer# tour date location seq_num
123 2/1/2012 Ardmore 1
123 2/5/2012 P&G - Dallas 2
123 2/6/2012 Dallas 3
123 2/8/2012 Ardmore 4
456 2/1/2012 Ardmore 1
456 2/4/2012 Ardmore 2
456 2/10/2012 DGStore - Dallas 3
456 2/20/2012 Ardmore 4
the developer's comment :
"Comes in handy on the db2 side when creating from-to date ranges.
I am a little surprised it isn't in informix since all the other major db systems (db2, SAP, Oracle) have something similar."
i told him that it could be we are missing something and said i'd try to get feedback through post here.
thanks in advance - Tom