Hi all,
I'm having a little bit of difficult and hopefully somebody can help me out here.
I have a table like:
GUID, TESTID, TESTDATE, TESTTYPE, TESTTYPEID
Now what I want to do is I know there are multiple rows with the same TESTID for the same TESTTYPEID.
So, I am trying to get an output of those for the same TESTID.
I am trying this:
SELECT TESTID, TESTDATE from MyTestTable WHERE TestTypeID=1100 and (TESTDATE >= '2014-09-03' and TESTDATE < '2014-09-04')
GROUP BY TESTID, TESTDATE
HAVING COUNT(TESTID) >=2
Now, this is not returning anything but I know for a fact there are records in the table that meet that situation. If I take out the HAVING clause then it will show them to and I see it but I also see all the others too. I only want the ones that have the COUNT(TESTID) >= 2
What am I doing incorrectly here?
This is SQL SERVER 2000.
Thanks
I'm having a little bit of difficult and hopefully somebody can help me out here.
I have a table like:
GUID, TESTID, TESTDATE, TESTTYPE, TESTTYPEID
Now what I want to do is I know there are multiple rows with the same TESTID for the same TESTTYPEID.
So, I am trying to get an output of those for the same TESTID.
I am trying this:
SELECT TESTID, TESTDATE from MyTestTable WHERE TestTypeID=1100 and (TESTDATE >= '2014-09-03' and TESTDATE < '2014-09-04')
GROUP BY TESTID, TESTDATE
HAVING COUNT(TESTID) >=2
Now, this is not returning anything but I know for a fact there are records in the table that meet that situation. If I take out the HAVING clause then it will show them to and I see it but I also see all the others too. I only want the ones that have the COUNT(TESTID) >= 2
What am I doing incorrectly here?
This is SQL SERVER 2000.
Thanks