473,385 Members | 1,324 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Extract the 3 most recent dates

I'm trying to create a view by selecting the 3 most recent dates from a table of dates. Is it possible to do this with max case? Sample code is very much appreciated.

Thanks!
Jun 25 '07 #1
4 1441
Saii
145 Expert 100+
Can you post your sample code here so that we can figure out what is missing in it.
Jun 25 '07 #2
I'm trying to create a view by selecting the 3 most recent dates from a table of dates. Is it possible to do this with max case? Sample code is very much appreciated.

Thanks!
select s.date from
(
select dense_rank() over (order by date desc)n,date
from
table
)s
where s.n<=3
Jun 26 '07 #3
debasisdas
8,127 Expert 4TB
the previous is the best solution ,still u can try this simple version

Expand|Select|Wrap|Line Numbers
  1. select * from tablename where rownum <4 order by date_field desc
You can create the view based on the above query.
Jun 26 '07 #4
My apology, I didn't fully explain what I am trying to do.
I have a set of data of employee numbers, events, and close_dates. The data includes several months of data. I only want to extract the most recent 3 dates for each employee. such as

1001 event1 06/25/2007
1001 event2 05/31/2006
1001 event3 04/02/2006
2002 event1 06/18/2006
2002 event2 06/11/2005
2002 event3 03/02/2005

Then I want to pivot the rows to columns, such as
1001 event1 06/25/2007 event2 05/31/2006 event3 04/02/2006

Thanks
Jun 26 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Nova's Taylor | last post by:
Hi folks, I am a newbie to Python and am hoping that someone can get me started on a log parser that I am trying to write. The log is an ASCII file that contains a process identifier (PID),...
5
by: rs | last post by:
I have a table with a timestamp field which contains the date and time. ie. 9/13/2004 9:10:00 AM. I would like to split this field into 2 fields, one with just the DATE portion ie 9/13/2004 and...
1
by: pht204 | last post by:
Hi there, I have a list of date on my table: ClientName ClientPurchase PurchaseDate PuarchesItems Let's say, the purchas dates are multiples and I want to get each clients with their most...
7
by: erikcw | last post by:
Hi all, I'm trying to extract zip file (containing an xml file) from an email so I can process it. But I'm running up against some brick walls. I've been googling and reading all afternoon, and...
2
by: robert.waters | last post by:
I need to perform the following: - select the most recent X number of records in a table (there is a timestamp field) - select the Nth occurrence of X number of records ex: - most recent 10...
13
by: djjohnst | last post by:
I am having a interesting issue. I work for a University's Career Services department. We collect data from recent grads. I am recreating the online survey we use. I am trying to populate the...
3
by: maylee21 | last post by:
hi, anyone can help me figure out how to read data from a text file like this: 10980012907200228082002 and extract the data according to this kind of format: Record type 1 TY-RECORD ...
1
by: GS | last post by:
I need to extract sections out of a long string of about 5 to 10 KB, change any date format of dd Mmm yyyy to yyyy-mm-dd, then further from each section extract columns of tables. what is the...
1
by: veer | last post by:
Hi i am making a program in which i want to extract data from html file . Actually there are two dates on html file i want to extract these dates but the main probleum is that these dates are...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.