Tips and Tricks
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Tips and Tricks
Message Icon Topic: selection formula Post Reply Post New Topic
Author Message
jjok
Newbie
Newbie
Avatar

Joined: 21 Sep 2011
Online Status: Offline
Posts: 2
Quote jjok Replybullet Topic: selection formula
    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.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet 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)
 
IP IP Logged
jjok
Newbie
Newbie
Avatar

Joined: 21 Sep 2011
Online Status: Offline
Posts: 2
Quote jjok Replybullet Posted: 21 Sep 2011 at 10:24am

ok, i will give that a spin. thanks.

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.