I need a statement that will return a 0 result from a query. I tried:
If Exists( select * from out_product
where productname not in
(select product from out_listownership))
I don't think we are clear on what you want, but you can try this to see if it close to what you are thinking. If not, perhaps try to describe a bit more what you are aiming at.
[tt]
Select (select count(*) from out_product
where productname not in
(select product from out_listownership)
) as TheCount
[/tt]
When I re-read, I see you want to check if it is zero. Perhaps you mean something like this inside a stored procedure or script?
[tt]
declare @mycount int
select @mycount = (Select (select count(*)
from out_product
where productname not in
(select product from out_listownership))
if @mycount = 0
do this
else
do that
-------------------
[/tt]
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.