Darren Duncan schreef:
> If you take ...
>
> +-+-+
> |a|x|
> |a|y|
> |a|z|
> |b|x|
> |c|y|
> +-+-+
>
> ... and divide it by ...
>
> +-+
> |x|
> |z|
> +-+
>
> ... the result is ...
>
> +-+
> |a|
> +-+
>
> I'm not sure if Divide has an equivalent in SQL.
A verbose way to do it:
SELECT C_abc
FROM T_abc_xyz NATURAL INNER JOIN T_xz
GROUP BY C_abc
HAVING Count(T_abc_xyz.C_xyz)
= (SELECT Count(*) FROM T_xz);
This basically filters the INNER JOIN result-set to only keep those
subsets that have the required number of rows.
It requires that the rows of each table are unique, so there can not be
another (b,x) in T_abc_xyz.
That is a normal requirement.
--
Grtz, Ruud