Login
Register
Search
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Forums
Performance Management
Lawson Business Intelligence/Reporting/Crystal
Command in Crystal
Home
Forums
Jobs
LawsonGuru
LawsonGuru Letter
LawsonGuru Blog
Worthwhile Reading
Infor Lawson News Feed
Store
Store FAQs
About
Who's On?
Membership:
Latest:
Chris Radcliffe
Past 24 Hours:
0
Prev. 24 Hours:
0
Overall:
5187
People Online:
Visitors:
312
Members:
0
Total:
312
Online Now:
New Topics
S3 Customization/Development
Cobol - Extract Current Time
4/24/2024 7:21 PM
How do you extract just the Current System Time in
Lawson Landmark
LPL INSTR Functions
4/5/2024 8:32 PM
I'm writing a simple report using the Create R
Infor SCM
Translating 856 to get the ~ REF^CN^ field
4/3/2024 8:24 PM
We are trying to get the tracking number which is
IPA/ProcessFlow
Sample XML file create Flow
4/3/2024 3:43 PM
Hello everyone, I am new to creating XML files
Lawson S3 HR/Payroll/Benefits
bn105 error message
3/26/2024 6:40 PM
I need to change some of the set ups in our Life I
IPA/ProcessFlow
IPA executing Job
3/13/2024 7:08 PM
New to the IPA world and was wondering, can an IPA
Lawson S3 HR/Payroll/Benefits
Life Age Reduction on benefits plans
3/12/2024 7:15 PM
For our optional life we have an age based coverag
Lawson S3 HR/Payroll/Benefits
BN53.1 Add-In
3/7/2024 3:31 PM
We are migrating to Solstice. They require a
Lawson Business Intelligence/Reporting/Crystal
Domain Name Change
3/5/2024 7:45 PM
Our domain name needs to change and was hoping I c
S3 Customization/Development
Cobol calling Shell Script
2/29/2024 1:27 PM
Has anyone created or modified a Lawson Cobol prog
Top Forum Posters
Name
Points
Greg Moeller
4184
David Williams
3349
JonA
3288
Kat V
2984
Woozy
1973
Jimmy Chiu
1883
Kwane McNeal
1437
Ragu Raghavan
1351
Roger French
1311
mark.cook
1244
Forums
Unanswered
Active Topics
Most Liked
Most Replies
Search Forums
Search
Advanced Search
Topics
Posts
Prev
Next
Forums
Lawson Business Intelligence/Reporting/Crystal
Command in Crystal
Sort:
Oldest First
Most Recent First
You are not authorized to post a reply.
Author
Messages
mil0n023
Veteran Member
Posts: 63
8/9/2006 1:50 PM
I am currently developing an Employee Review report - linking 3 tables (EMPLOYEE, PAEMPLOYEE, & REVIEW) now I want to add a command to just provide an Employees most recent Last Review - does this look correct? Also, will adding a command along with tables that are linked - jeopardize the report at all?
Here is the command:
SELECT REVIEW.EMPLOYEE, REVIEW.ACTUAL_DATE,
FROM LAWSON.REVIEW REVIEW,
WHERE REVIEW.ACTUAL_DATE = (SELECT MAX(REVIEW.ACTUAL_DATE)
FROM LAWSON.REVIEW REVIEW
WHERE REVIEW.EMPLOYEE = REVIEW.EMPLOYEE)
Thanks!
John Henley
Senior Member
Posts: 3348
8/9/2006 2:40 PM
That's close, but not quite, since your "REVIEW" aliases are named the same in the outer and inner queries. In addition, you have a few too many commas. Regardless, what you're asking for doesn't even require a nested query; you can do it with a single query:
SELECT REVIEW.EMPLOYEE, MAX(REVIEW.ACTUAL_DATE)
FROM LAWSON.REVIEW REVIEW
GROUP BY REVIEW.EMPLOYEE
This will generate a list of employees WHO HAVE HAD REVIEWS and their latest review date.
You then should LEFT JOIN to this resultset so that your report will include employees who don't have reviews; if you just did a JOIN (or INNER JOIN), it would drop employees without reviews from your report.
A final note on nested queries: ALWAYS ALWAYS ALWAYS (and yes ALWAYS) make sure you include the full PRIMARY KEY in the WHERE clause. In your example, you only had EMPLOYEE. You should include COMPANY as well, otherwise you will be doing a table-scan (read: bad performance!) when the join is performed.
mil0n023
Veteran Member
Posts: 63
8/10/2006 2:07 PM
John - thanks!
I decided to go the traditional Database Expert and use the Crystal Functionality. But, NOW, the way I have this report built, with various dates, and an Nth Largest =1 on a particular date field, I am placing my results in the Group Header. I have 2 Groups - 1)Employee Home Dept # 2) Employee #
How can I get this report to sort by one of the date fields? (Next Review - managers want too see the oldest date first) It does not sort at all...
John Henley
Senior Member
Posts: 3348
8/10/2006 3:04 PM
Insert a group on next review and suppress the group header/footer.
You are not authorized to post a reply.