Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Min/Max Date-Time Stamp Sorting

Posted on 1998-12-11
4
Medium Priority
?
286 Views
Last Modified: 2013-12-25
I have an ODBC Access data source that has data structured in this format:  Product ID, Value 1, Value 2, Value 3, Date-Time Stamp of when values were recorded.  The product ID repeats several times as readings are taken at different times - i.e., I have multiple entries for each ID.  I want to report in summary style, only the minimum and maximum date-time records with associated values in Crystal Reports.  Can anyone provide me an explanation that would allow me to summarize in this fashion?
0
Comment
Question by:mgt4rwg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Author Comment

by:mgt4rwg
ID: 1498171
Edited text of question
0
 
LVL 5

Expert Comment

by:mayhew
ID: 1498172
Do you want the min and max for *each* product ID?

What version of Crystal are you using and how are you getting your result set (i.e. SQL Query or wizard)?

If you are using a SQL query, please post it and we'll take a look.  :)

However you populate your result set, the answer is going to be along the following idea.  You'll need to add a condition (for example, a where clause at the end of your select) that sets the data equal to the max OR the min.

In pseudo-SQL, something like:

SELECT <data> FROM <table> WHERE <date-time stamp> = (SELECT MAX(date-time stamp) from <table>)
OR <date-time stamp> = (SELECT MIN(date-time stamp) from <table>)

This will grab the high and low regardless of product id.  If you want this info for each product id, it's a little bit more complicated, but still doable.

Again, if you post the info asked for above, maybe we can give you a more concise answer.

Don
0
 
LVL 5

Accepted Solution

by:
AnswerTheMan earned 200 total points
ID: 1498173
from my experoience with crystal reports - if u are not prepared well with your db be4 u go there - it's a waste of time.
do just this : prepare a temporary table with access with all
the records u want to show in the report. (only those u want !!
sort it out yourself in CODE !!!)
then - link crystal to this temporary table. it will work fine.
 
0
 
LVL 5

Expert Comment

by:mayhew
ID: 1498174
AnswerTheMan,

I would agree with you if this were a particularly exotic query.  For this kind of thing, though, I've found Crystal to be adequate.  But whether mgt4rwg does it in Crystal or with code, he/she is probably going to need to know how to do the query.

Even so, instead of a temp table (can you even do that in Access?) I would just set up a query in Access and link to that through Crystal.

mgt4rwg,

If you post the kind of info I asked for above, one of us will be happy to look at it.

Don
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

688 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