Skip to Content
author's profile photo Former Member
Former Member

retrieving records with condition

Post Author: mtn17

CA Forum: General

Hi,

Is there a formula to tell crystal report to return certain records? For example, one patient has one or more admission records, but I only want to retrieve one record with the most recent admission date for that patient?

Thanks for your help.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 06:56 AM

    Post Author: amr_foci

    CA Forum: General

    mtn17,, whats the problem with that??

    u tried "Select Expert" ??

    good luck

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 03:39 PM

    Post Author: kcheeb

    CA Forum: General

    You could do a summary on the admission date and tell it to use the maximum.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 31, 2008 at 04:57 PM

    Post Author: amr_foci

    CA Forum: General

    sorry,, i got your problem now, i faced this before and solved it using complex query "Add Command" and wrote my SQL in free hand sql and solved it by "in" like this way

    select a.pat_id,a.inv_no from patient_invoices a where a.MY_DATE in (select max(b.MY_DATE) from patient_invoices b where b.pat_id = a.pat_id)

    it will give you only one record for every pat_id

    good luck

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 03, 2008 at 09:22 PM

    Post Author: Jagan

    CA Forum: General

    Group by patient id and use the group selection formula to get just the most recent record per group, i.e.{patient.admission_date} = maximum({patient.admission_date}, {patient.id})

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.