Select last 50 records closed

Advertisement

Looking for a simple sql select statement that will select the last 50 records closed in the database.
I found a few helps out there that have an example like:
SELECT RecordID, closed_date
FROM ( SELECT RecordID, closed_date, RANK() OVER (ORDER BY closed_Date DESC) date_rank
FROM table1 )
WHERE date_rank <= 50;
Only problem is, this is selecting something like 4000 records and many of them are not even closed.

Advertisement

I believe you should retrieve the records that are only closed first.
Try this,
SELECT RecordID, closed_date
  FROM (SELECT RecordID,
               closed_date,
               ROW_NUMBER () OVER (ORDER BY closed_Date DESC) rn
          FROM table1
         WHERE closed_date < SYSDATE)  --Notice this.
WHERE rn <= 50;G.

November 30, -0001

Select last 50 records closed

Looking for a simple sql select statement that will select the last 50 records closed in the database. I found a few helps out there that have an example like: SELECT RecordID, closed_date FROM ( SELECT RecordID, closed_date, RANK() OVER (ORDER BY cl

How to find the last records of the table in adventure work db

hi all, i want to find out " how to receive a last records of the table (eg:  person.emailaddress ) in sql 2008 and 2005" ThanksIf you are looking for the latest record( the one which got inserted/modified last) then use this query select top 1

How to select multiple records in ALV with out pressing ctrl

Hi Experts, Is there a way to select multiple records in ALV with out pressing ctrl button on the key board? Selection and deselection should allow multiple records. any clue is highly appreciated. regards, AjayThe keyboard always plays a role, altho

Puzzle why query returned wrong value for last record in update.

Hi all, 10.2.0.4, Windows 32 bit. Apply 15% dis.count to related 5 items ( total amount 522 ) sorted by lowest amount first (amount = 1). Last record ( amount = 200 ) will be the total dis.count amount ( 78.3 ) less applied accumulated dis.count amou

Problem on forms for serial number generation with last record next_record.

Hi Experts, currently i'm facing one problem like : i'm populating one receipt detail in Multi block , like when user key in one receipt number that time record should go in first record ,and if they key in second receipt number then record should go

How to get to the last record of an APEX report automatically?

In Oracle Forms there is a "lastrec" command which can be placed after a call to a multi-row form.  The records called have the last record at the bottom of the page.  For example, if there are 100 records and there are 10 rows on the form, reco

Last record

hi all, in cursor how to find out the last record. for example if the data not found in the select statement( if cur%notfound then do operation) do we have any built in like %found or %notfound to find the last record. if no is there is any solution.

RANGE_PAGING LAST RECORD IN JSP PAGE

Hi. I'm working in JDeveloper 10g, and I would like to know what should be the behavior for the Last button on a jsp page when I use the method setAccessMode with RANGE_PAGING mode?, I mean, when I press that button in my jsp page it doesn't go to th

How to fetch last record from a flatfile

I have a flatfile with 5000+ records and last record is the count record , i want to fetch the last record only through sql loader or External table (OS IS Unix) Pls any body can give the answer Kiran Kumar Thayyuru Message was edited by: user557500y

How to know the internal table's last record

Dear friends, Just I want to know my internal table last records, Ex: I am having the records in my internal table like this: Itab-col1 1 2 3 4 5 6 7 8 9 I want to know and print the last record, it maybe n number of records in my itab. If I used at

Displaying the selected multiple records from node using onleadselect event

Hi all, How to display the selected multiple records from node to node using onleadselect event. i came to know tht to fulfill this requirement i need to use the method get_selected_elements, how to use this method in my event?? sreeHi Sree, Try belo

Applescript - Selecting Last Group in List

Hello, I'm trying to select the Guest User in System Preferences.  I've gotten to the Users & Groups pane, but I need some way to select the last group (guest user) without saying something like "Group 4" since I'll be using this on computer

How to get the last record from the database

I am using MS Access database and Swings as GUI. I want to get the last record of a particular column from the table and store it as a varaible.Hi To get Last record of resultset, you have pass some parameter in constructor of CreateStatement.In such

Not enough space to print the last record on each page

Hello, My report looks like a simple list table, with the first row as the column header, followed by rows of records. The fields are placed on the Detail section and they're set with "Can Grow" property. That means, records may have different r

Analytic query to select next record

Hi all, I would like to query the below two table match to ouput. 1.dev_wt 2.dev_map 3.Output Result To help more clearance please see this image link : http://lh6.ggpht.com/_xL6eBqjW6Yo/TEqnSvlF_FI/AAAAAAAAB0U/i2sclnnaj6g/Untitled-3.jpg 1. dev_wt PM

Main Reports' Group Tree doesn't retain last record selected

In Crystal 2008 Viewer, when you click one of the last tree nodes on a long Group Tree, the program jumps to that part of the report for that group.  But when you return to the Main report tab the Group Tree pane returns to the top. According to my u

Getting first and last records of sql using a analytical function query

hi all! Thanks in advance for looking at my problem! I have a query that runs against a table that keep all records of changes on another table (journal table kind of thing). I wrote a sql that would tell what the status of that requisition was, what

Max and last record....

I need to find in an historical table the employee position at a certain date...to do so I max the effective date of the position and I test on the expiry date with a variable to determine at which period. Select max (empposn_effdt) from empposn_t p1

Selecting FIRST record w/o fetching them all

Hi: Is there a way to select any one record from a set or potentially many without having to actually fetch them all? For example, I want to get the last name of only one person with the first name 'joe' from the employees table. I don't care which "

Failure of last record to commit on insert

I have just completed an application that reads records from an ASCII file and inserts them into an MS Access database. The application worked fine until for performance sake I moved the connection creation outside my loop that reiterates the file re