Print Page | Close Window

selection formula

Printed From: Crystal Reports Book
Category: Crystal Reports 9 through 2020
Forum Name: Tips and Tricks
Forum Discription: Have you learned some great tricks to share with the group? Post them here!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=14434
Printed Date: 18 May 2024 at 1:38pm


Topic: selection formula
Posted By: jjok
Subject: selection formula
Date Posted: 21 Sep 2011 at 5:56am
OK, probably a really easy solution to this one. I have a database which contains all employees and the many training classes they have completed. Each employee has completed several classes. I would like to select those employees who have NOT completed a specific training class. Any suggestions for what selection formula to use? If I use the "not one of" or "<>" it doesn't give me the proper list.



Replies:
Posted By: DBlank
Date Posted: 21 Sep 2011 at 8:08am

in a command you can do a grouped selection of employee and outerjoin it to the a grouped selection of employee where specific training class was done. then select only records where they second table has no matching record in the first.

SELECT     table.employee
FROM         table LEFT OUTER JOIN
                          (SELECT     employee
                            FROM          table AS table_1
                            WHERE      (class = 'specific class name')
                            GROUP BY employee) AS D1 ON D1.Employee = table.employee
GROUP BY table.employee, D1.employee
HAVING      (D1.employee IS NULL)
 


Posted By: jjok
Date Posted: 21 Sep 2011 at 10:24am

ok, i will give that a spin. thanks.




Print Page | Close Window