Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Most Recent Record In a Table

Posted on 2010-01-02
Medium Priority
Last Modified: 2013-11-15
I have a table that shows sales data. I want to see a list of the most recent sales record for all customers. How can I do this.
Question by:evend
LVL 101

Accepted Solution

mlmcc earned 1000 total points
ID: 26164149
The easy way is to add a group on the report by customer
Then add a sort descending on sales date
Put the information in the group header and you will have the latest sale

LVL 41

Expert Comment

ID: 26164462
try this.
select t1.*
  from YourTable as t1
 inner join (select Customer,max(Sales_Date) as Sales_Date from YourTable) as t2
    on t1.Customer = t2.Customer and t1.Sales_Date = t2.Sales_Date

Open in new window

LVL 11

Expert Comment

ID: 26164620
Select * From Table Order By Sales_Date Desc

Assisted Solution

louisgh earned 1000 total points
ID: 26164952
you can sort the fields ascending by date of the sale, and put your fields in the header section .. it will give the first record of your sorted data ( recent sale )

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1. Set up your parameter at the report level as usual, check the box Multi-value, and set the Data Type to String 2. Set the Stored Procedure Parameter to varchar(max)  --<---- This part here is the key to it's success Example:    @cst_key var…
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question