Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9124591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:36:24+00:00 2026-06-17T06:36:24+00:00

I am using Sybase which doesn’t support a lot of cool functions that people

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:36:25+00:00Added an answer on June 17, 2026 at 6:36 am

    After taking a look at sybase documentation it seems like you have a rank function. So here’s a stab at it:

    declare @table table ( tp varchar(30), rowtime datetime, quantity int) 
    
    insert @table select 'cat1 1', '20120101', 50
    insert @table select 'cat2 1', '20130101', 50
    insert @table select 'cat3 1', '20110101', 50
    insert @table select 'cat4 1', '20100101', 50
    insert @table select 'cat5 1', '20090101', 50
    select * from (
       select *, RANK() OVER (ORDER BY  RowTime DESC) AS Rank from @table 
    ) a
    where [RANK]=1
    

    Got the rank function from here:
    http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc00169.1270/html/iqperf/CEGDJFCE.htm

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using an older version of sybase which does not have keywords like
I am using an older version of sybase which does not have keywords like
I'm using the Sybase database, How do I change SQL timestamp which appears in
I've written a C++ DLL that connects to a Sybase database using the native
I have an ASP SqlDataSource connected to Sybase DB query, using Select Parameters that
I am using Sybase Jconnect Driver Jconn3 to execute stored procs which return upto
I am using hibernate framework to be able to use Oracle or Sybase (customer
I have taken over support of a VB .Net application that makes use of
I am executing the select statement with using jdbc sybase driver ( jconn3 ).
I have a standalone application that needs to connect to a Sybase database via

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.