Question : What's wrong in the followin sql server 2000 query

Hi,

When I run this query I am getting

"Server: Msg 156, Level 15, State 1, Line 9
Incorrect syntax near the keyword 'INTERSECT'."

any ideas why ??

---------------------------------------------------------
select a1.RecipeTitle from
dbo.Recipes a1
inner join dbo.Recipe_Ingredients a2
on a1.RecipeID=a2.RecipeID
inner join dbo.Ingredients a3
on a2.IngredientID=a3.IngredientID
where a3.IngredientName='Beef'
INTERSECT
select a1.RecipeTitle from
dbo.Recipes a1
inner join dbo.Recipe_Ingredients a2
on a1.RecipeID=a2.RecipeID
inner join dbo.Ingredients a3
on a2.IngredientID=a3.IngredientID
where a3.IngredientName='Onion'

Answer : What's wrong in the followin sql server 2000 query

please try this:
1:
2:
3:
4:
5:
6:
7:
8:
9:
select a1.RecipeTitle 
from dbo.Recipes a1
where 2 = ( select count(*) 
        from dbo.Recipe_Ingredients a2
        join dbo.Ingredients a3
          on a2.IngredientID=a3.IngredientID
         where a3.IngredientName IN ( 'Beef', 'Onion' )
         WHERE a1.RecipeID=a2.RecipeID
       )
Random Solutions  
 
programming4us programming4us