You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Legolas Woodland <le...@gmail.com> on 2006/05/08 00:35:42 UTC
Problem with sql statement , can some one help me to get count of
a complex select ?
Hi
Thank you for reading my post.
i really tried to get count of rows that this statement return with no
luck.
SELECT * FROM categories WHERE categories.categoryid NOT IN
( SELECT DISTINCT categoriescategoryid
FROM BANNER_categories WHERE BANNERBANNERID = 10)
if we think this statement is A then i tried :
I tried :
select count(*) from (A)
select count(A)
select count(*) , A
....
but still i can not find this statement total returning rows.
Re: Problem with sql statement , can some one help me to get count of a complex select ?
Posted by Daniel Morton <dj...@yahoo.com>.
Assuming your query works the way it is suppsoed to
(ie. when you run the query, it returns the correct
rows) then you should be able to do:
SELECT COUNT(*)
FROM categories
WHERE categories.categoryid NOT IN
(
SELECT DISTINCT categoriescategoryid
FROM BANNER_categories
WHERE BANNERBANNERID = 10
)
Which is slightly different from the 3 examples you
listed.
Hope this helps.
Dan Morton
>
> SELECT * FROM categories WHERE
> categories.categoryid NOT IN
> ( SELECT DISTINCT categoriescategoryid
> FROM BANNER_categories WHERE BANNERBANNERID =
> 10)
>
> if we think this statement is A then i tried :
> I tried :
> select count(*) from (A)
> select count(A)
> select count(*) , A
> ....
>
> but still i can not find this statement total
> returning rows.
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com