Print Page | Close Window

How to pull first line of data from multiple rows

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Technical Questions
Forum Discription: Formulas, charting data, Crystal syntax, etc.
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=22484
Printed Date: 02 May 2024 at 11:45am


Topic: How to pull first line of data from multiple rows
Posted By: SNelson
Subject: How to pull first line of data from multiple rows
Date Posted: 24 Oct 2017 at 8:39am
I need to select the first record for each 'customer' in my database. There is a field that has the row/record number for each customer but this number doesn't always start with '1'. Is there a way to select the record based on the minimum value of this field? Or another way?

In the select expert the only options are less than, greater than, equal to, etc. This doesn't work b/c the minimum value isn't the same for each customer.

Thanks for any help!

-------------
SNelson



Replies:
Posted By: kevlray
Date Posted: 24 Oct 2017 at 11:23am
Sort of.  You can group by 'customer' and display the information in the group header (suppress the detail).  Not sure what will determine the first row though for each customer.


Posted By: SNelson
Date Posted: 25 Oct 2017 at 9:58am
I've also created a running total, which does let me number by customer beginning from 1, but I can't use that in the select expert.

I wondered if an SQL query would work instead. I've seen something similar using this idea:
( select
      min(case...)
)


-------------
SNelson



Print Page | Close Window