Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Jun 2003
    Location
    New Jersey
    Posts
    103
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Crystal 9.0 help with max function (Crystal 9.0)

    Need help with a Maximum function

    I have a table with start date, enddate, dept, & empname. How do I in Crystal select only the most current record?

    Pleeeeeeease help.
    Thank you

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    USA
    Posts
    386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Crystal 9.0 help with max function (Crystal 9.0)

    When you design the report to show your fields on the report, Crystal creates the SQL for that report.
    You can edit this SQL from the Report menu if I remember correctly.
    If you edit the SQL and add a WHERE clause similar to the following you should get the max startdate for each individual.

    WHERE startdate in (SELECT max(startdate) FROM tablename A WHERE A.empName = tablename.empname)

    tablename will be the name of your table. You may have to tweek the syntax to match how Crystal creates the SQL, but this should give you an idea how to create the sub select.


    Good luck
    Richard

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •