Posted by Hiho on 01/24/08 16:00
> SELECT x, y
> FROM Foo AS F
> CROSS APPLY (SELECT y FROM Bar AS B1 WHERE B1.x = F.x
> UNION
> SELECT y FROM Bar AS B2 WHERE B2.x = F.x) AS B
> WHERE y IS NOT NULL;
Yeah, that's it !
But I'm under SQL Server 2000.... I think I'll keep the first
solution.
S. Rielau : the problem is the "WHERE B1.x=F.x".
If I write SELECT X FROM F, (SELECT ... FROM B1 WHERE B1.x=F.x) AS F1
SQL Server doesn't recognize F.x.
[Back to original message]
|