Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help selecting only the record with the last update

Status
Not open for further replies.

jkupov

Technical User
Apr 28, 2004
101
US
In my DB I have a field that stores a timestamp every time there is a status update to the customer's order. A new record (line of data) is created every time the order is updated.

In my query, I have selected the transaction number (35109) and the status code (status_cd)for each time the order has been viewed by an employee (status code= vw). I am also displaying the time stamp for each time the employee views the order ( Status_up_tm).

The problem is that every time I execute my report it shows a line of data for every time an employee viewed the order (or every time the status code vw).How do I get it to only show the last time an employee viewed it on my report rather than having several lines of data? I want to shorten it to only display the last viewed time.

I'm assuming that I somehow need to tell it to look at the field status_up_tm and discern which of the records has the most recent time and then only display that record- but I am at a loss as to where to start.

Thanks.
 
Insert a group on an Order ID field ({table.orderID}), and then go to report->selection formula->GROUP and enter:

{table.status_up_tm} = maximum({table.status_up_tm},{table.orderID})

-LB
 
OK... that makes sense. And if I want to group first by our customers then I would have them as the first level group and then add the orderID field as a group under that and do a group selection formula on it. I think I've got it. Thanks for steering me in the right direction!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top