var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: First and last record id in a select query
Is there a function or a way in sybase to get the first and last record id number in a select query?
example: SELECT FIRST(tr_id).....FROM...
Thank you in advance for your help, is much appreciated it!
but let me complicate it a little more:....I need to get the min(tr_id) and the max(tr_id) for every 500,000 records.
Can this be done?
set rowcount 500,000
SELECT MIN(TR_ID) AS mintrid, MAX(TR_ID) AS maxtrid
WHERE pr_id > 0
ORDER BY pr_id;
no, sorry, doesn't make sense to me, maybe someone else?
set rowcount wouldnt work.
Originally Posted by Malachi4
Not sure why you want want to do it for every 500k, but if you do need to do it, you need to have a condition where you can identify the 500k rows uniquely.
For eg., maybe you have a sequential primary key.
you can say, WHERE myseqid between 1 and 500000 and so on... but dont think it can be done in one single sql