June 10, 2005 at 1:28 pm
How can I query this:
select count(doc_iccmc) cnt,doc_iccmc from v_DOCUMENTDIRECTORY
where cnt >2
group by doc_iccmc
It errors. I guess cause CNT isn't a "real" column. How do you use COUNT in a where statment? Thanks.
June 10, 2005 at 1:33 pm
Shouldn't the query be:
select count(doc_iccmc) cnt,doc_iccmc from v_DOCUMENTDIRECTORY
where count(doc_iccmc) >2
group by doc_iccmc
mom
June 10, 2005 at 1:33 pm
select count(doc_iccmc) cnt,doc_iccmc from v_DOCUMENTDIRECTORY
group by doc_iccmc
Having count(doc_iccmc) > 2
June 10, 2005 at 1:35 pm
Remi,
Your solution would be right. Hm I guess I should stop to think for a second before trying to answer.
mom
June 10, 2005 at 1:36 pm
I was rereading your post and didn't see any difference... Was wondering if I were going blind all of a sudden.
Anyways, I think I would use Count(*) if case permits... allows more options to the query optimizer.
June 10, 2005 at 1:41 pm
Of course the lovely HAVE clause.
Thanks MOM and Remi. Much appreciated.
June 10, 2005 at 1:44 pm
HTH.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply