Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 17268 |  Welcome, Guest!   Register  Login
 Home > Blogs > SQL Server > Get Recent records from the table ...
Jvprabhusanthi

Get Recent records from the table

 Blog author: Jvprabhusanthi | Posted on: 5/4/2012 | Category: SQL Server Blogs | Views: 616 | Status: [Member] | Points: 75 | Alert Moderator   
Ads

Here is a small code snippet for getting the recent records from the table. 

drop table VENKAT_TABLE
go
create table Venkat_Table(code varchar(100),rate decimal(10,8),date1 date)
go
insert into VENKAT_TABLE values ('sam', 1.240000, '01/08/2004') 
insert into VENKAT_TABLE values ('sam', 1.840000, '02/08/2004') 
insert into VENKAT_TABLE values ('pal', 1.240000, '01/08/2005') 
insert into VENKAT_TABLE values ('pal', 0.840000, '10/08/2003') 

select code,rate,date1 from 
(
select ROW_NUMBER() over (partition by code order by date1) as rank1,*
  from VENKAT_TABLE ) t
  where rank1=1
 
Cheers,
Venkatesan Prabu .J
Head, KaaShiv InfoTech


Cheers,
Venkatesan Prabu .J
Head, KaaShiv InfoTech
http://kaashivinfotech.com/Ebooks.aspx
Found interesting? Add this to:


Experience:9 year(s)
Home page:http://www.dotnetfunda.com
Member since:Tuesday, May 01, 2012
Level:Starter
Status: [Member]
Biography:
>> Write Response - Respond to this post and get points

More Blogs

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/19/2013 12:55:38 AM