williamkremer
Programmer
- Oct 27, 2005
- 61
Hi all -- I'm trying to get a query which will return ONLY results which have a count greater than a certain number (in this case, 200, but that's arbitrary) but my query is returning odd results so I don't trust it.
***************************************
select count(*) as No_imports, createon as Date_created, Createby from contact1 where createon in
(select createon from contact1 group by createon having count(*) > 200)
group by createon, Createby
order by createon, Createby
*******RETURNS:
No_imports Date_created Createby
----------- ---------------------- --------
4 2004-04-02 00:00:00.000 IVANNIA
8 2004-04-02 00:00:00.000 MICHELLE
400 2004-04-02 00:00:00.000 MUDIT
1 2004-04-02 00:00:00.000 RACHAEL
8 2004-04-02 00:00:00.000 TRINA
3 2004-04-12 00:00:00.000 EMEE
17 2004-04-12 00:00:00.000 IVANNIA
200 2004-04-12 00:00:00.000 LISAL
6 2004-04-12 00:00:00.000 MICHELLE
1 2004-04-12 00:00:00.000 TRINA
9 2004-05-25 00:00:00.000 EMEE
5 2004-05-25 00:00:00.000 IVANNIA
382 2004-05-25 00:00:00.000 LISAL
4 2004-05-25 00:00:00.000 MICHELLE
****************************
I am getting 4, 8, 1, 8, etc, as well as the numbers over 200. What am I doing wrong (this time)?
Thanks for helping.
***************************************
select count(*) as No_imports, createon as Date_created, Createby from contact1 where createon in
(select createon from contact1 group by createon having count(*) > 200)
group by createon, Createby
order by createon, Createby
*******RETURNS:
No_imports Date_created Createby
----------- ---------------------- --------
4 2004-04-02 00:00:00.000 IVANNIA
8 2004-04-02 00:00:00.000 MICHELLE
400 2004-04-02 00:00:00.000 MUDIT
1 2004-04-02 00:00:00.000 RACHAEL
8 2004-04-02 00:00:00.000 TRINA
3 2004-04-12 00:00:00.000 EMEE
17 2004-04-12 00:00:00.000 IVANNIA
200 2004-04-12 00:00:00.000 LISAL
6 2004-04-12 00:00:00.000 MICHELLE
1 2004-04-12 00:00:00.000 TRINA
9 2004-05-25 00:00:00.000 EMEE
5 2004-05-25 00:00:00.000 IVANNIA
382 2004-05-25 00:00:00.000 LISAL
4 2004-05-25 00:00:00.000 MICHELLE
****************************
I am getting 4, 8, 1, 8, etc, as well as the numbers over 200. What am I doing wrong (this time)?
Thanks for helping.