Reiner, I don't know if this was your workaround, but here's another solution that just uses SQL::Statement ...

Ludwig, Michael wrote:
So the next thing I tried was the anti-join (see

  http://en.wikipedia.org/wiki/Relational_algebra#Antijoin

First time I hear of this "antijoin".

The example given on the Wiki page doesn't make much sense
to me. Isn't is simply an OUTER JOIN where you're looking
for NULL on the right-hand side?

SELECT E.Name, D.DeptName
FROM Employee AS E
LEFT JOIN Dept AS D ON E.DeptName = D.DeptName
WHERE D.DeptName IS NULL

An "antijoin", aka "anti-semijoin", aka "semidifference" will filter one rowset to retain just the rows that don't have matching rows in the other one. The closest SQL analogy is

"SELECT ... FROM source WHERE ... NOT IN (SELECT ... FROM filter)"

But yes, Michael's solution is basically correct, and here's a closer variant of what antijoin does:

  SELECT E.*
  FROM Employee AS E
    LEFT JOIN Dept AS D USING (DeptName)
  WHERE D.DeptName IS NULL

The key difference here is that the result of an antijoin is all of the columns of the source table and only those.

Reiner, you're probably better off to just use this SQL solution if you can.

Set::Relation is superfluous for this task actually.

-- Darren Duncan

Reply via email to