I am using an older version of sybase which does not have keywords like lead.
I have a table like one shown below.
Type Row Time 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
I have above data available for cat2, cat3, etc. as well. The data is arranged in increasing order of time.
I want to generate a new table from the above table where the values only starting at 10.01.01.002 and later would be present as it is the first row/time where the minimum required quantity of 1000 is satisfied. i.e. include rows 3, 4, and 5 in new table as it is only at 3rd row that minimum quantity is fulfilled. The above data is for cat1, cat2, etc.
The table above is massive so I am looking for an efficient method.
Thanks
You can use TOP 1 to find the first item of your criteria then use that in a select statement.
Like this (not sure your exact requirements)