Just a single table with 3 columns (name,project,hours), the following works fine, but is there a better way to right this?
SELECT DISTINCT name FROM WorksOn a
WHERE NOT EXISTS
(SELECT * FROM WorksOn b
WHERE b.name = 'Smith' AND NOT EXISTS
(SELECT * FROM WorksOn c
WHERE a.name = c.name AND
c.project = b.project AND c.hours = b.hours))
Last Wiki Answer Submitted: October 26, 2012 4:41 am by testaduro55 pts.
If you live outside the United States, by submitting your email address you consent to having your personal data transferred to and processed in the United States.
What problem are having with doing that? — Tom
Not really a problem, just looking for an alternative to an existing stmt that I have created.
We need to know the table formats that are used. Your existing statement would also be a real help. — Tom
Can you explain why you are using those ‘NOT EXISTS’ conditions ?
Maybeselect * from WorksOn a join
(select * from WorksOn where name = ‘Smith’) b
on a.project = b.project AND a.hours = b.hours and a.name <> b.name