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 6735167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:58:36+00:00 2026-05-26T10:58:36+00:00

Am trying to create a NETEZZA table which has only the most recent records

  • 0

Am trying to create a NETEZZA table which has only the most recent records for a particular key – eg imagine a table (MYTABLE) as follows:

Col1 Col2 TIMESTAMP
xxxx xxxx 13:45
xxxx xxxx 13:46
xxxx yyyy 10:00

I would like to return a table as follows:

Col1 Col2 TIMESTAMP
xxxx xxxx 13:46
xxxx yyyy 10:00

I’m guessing I need some code along the lines of:

  Create table MYNEWTABLE as
    select *
    from MYTABLE
    WHERE rowid in
    (
    SELECT LAST_VALUE(rowid)
    OVER (PARTITION BY COL1, COL2
          ORDER BY TIMESTAMP)
          FROM MYTABLE
    )
    ORDER BY COL1,COL2
    distribute on (COL1)

However this isn’t really working, can anyone please advise? (specifically how to filter the table by the last value of timestamp within the col1 / col2 partition)

  • 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-05-26T10:58:37+00:00Added an answer on May 26, 2026 at 10:58 am

    Got it – finally! rowid was a misnomer. Credit to Shawn Fox of Netezza Community for inspiration.

      Create table MYNEWTABLE as select * from
        (select *
                ,row_number() over (
                     partition by COL1, COL2 order by TIMESTAMP desc
                                   ) row
           from MYTABLE 
        ) x
        WHERE x.row=1
        distribute on (COL1)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
I'm trying to write a table trigger which queries another table that is outside
Trying to create a table for quantiles of the sum of two dependent random
I'm trying create this function such that if any key besides any of the
I am trying create an application which will clone the GIT repository to the
I am trying create a table and add this table into tablecell (table inside
I am trying create a data.frame from which to create a graph. I have
Trying to create an Oracle trigger that runs after a table is updated in
Trying to create a request only to have a runtime error thrown. Method initiating
I am trying create a simple WQL query where I only return mounted drives

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.