Count and Reset Row Numbers per Group

  • I have a report where I need to get a random set <= 35 per group. I work in Sybase Rapid SQL so there are some functions that do not work in there.

    This one works fine but I can't get it to reset for each group (prsn_id)

    tmp_rownum numeric(10,0) identity

    Select TOP does not work. Does anyone have a suggestive approach?

    Ideally, I would like the result set to find all the records but limit it to no more than 35 record rows per prsn_id. Should I be using a @counter loop assign a row number and reset each time the prsn_id changes? Is this something I can do from a temp table?

  • I should also say that this is not accepted either

    ROW_NUMBER() OVER (PARTITION BY prsn_id order BY prsn_id)

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply