I am using Sybase which doesn’t support a lot of cool functions that people use here. So, please keep that in mind while helping me.
I have a db which looks something like this:
Type RowTime Quantity cat1 1 10:01:01.000 50 cat1 2 10:01.01.001 0 cat1 3 10:01:01.002 1000 cat1 4 10:01.01.003 100 cat1 5 10:01:03.001 100
Except there are cat2, cat3, cat4, etc as well.
I want to find the extract the last row from each category based on time arranged in ascending order. So, for the given table above I want to extract row 5.
After taking a look at sybase documentation it seems like you have a rank function. So here’s a stab at it:
Got the rank function from here:
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00169.1270/html/iqperf/CEGDJFCE.htm