Connecting Tech Pros Worldwide Help | Site Map

SQL Count(*)

  #1  
Old July 10th, 2007, 04:15 PM
davy.cox@gmail.com
Guest
 
Posts: n/a
I would like to make an SQL that counts the records resulting from an
other SQL:

This is the Query resulting the records (31 in my test)

SELECT A.customerid FROM A INNER JOIN customers ON A.customerid =
customers.Customerid WHERE Left([PeriodeID],8)='20070625' AND
customers.Companyid=97 GROUP BY A.customerid;


I would like just one record result with the total count of the
records in this query: 31
I tried things like:

SELECT Count(*) FROM (SELECT A.customerid FROM A INNER JOIN customers
ON A.customerid = customers.Customerid WHERE Left([PeriodeID],
8)='20070625' AND customers.Companyid=97 GROUP BY A.customerid;)

But he keeps on giving me an error on the FROM clause

Anyone who can help me, probably supper simple, but I gave up
searching and really can't find it.

Thanks in advance

  #2  
Old July 10th, 2007, 06:25 PM
Yitzak
Guest
 
Posts: n/a

re: SQL Count(*)


On 10 Jul, 16:08, davy....@gmail.com wrote:
Quote:
I would like to make an SQL that counts the records resulting from an
other SQL:
>
This is the Query resulting the records (31 in my test)
>
SELECT A.customerid FROM A INNER JOIN customers ON A.customerid =
customers.Customerid WHERE Left([PeriodeID],8)='20070625' AND
customers.Companyid=97 GROUP BY A.customerid;
>
I would like just one record result with the total count of the
records in this query: 31
I tried things like:
>
SELECT Count(*) FROM (SELECT A.customerid FROM A INNER JOIN customers
ON A.customerid = customers.Customerid WHERE Left([PeriodeID],
8)='20070625' AND customers.Companyid=97 GROUP BY A.customerid;)
>
But he keeps on giving me an error on the FROM clause
>
Anyone who can help me, probably supper simple, but I gave up
searching and really can't find it.
>
Thanks in advance
Shouldn't the semi colon be the last item?

GROUP BY A.customerid;) ---GROUP BY A.customerid);



  #3  
Old July 11th, 2007, 02:15 PM
Bob Quintal
Guest
 
Posts: n/a

re: SQL Count(*)


davy.cox@gmail.com wrote in
news:1184080130.653524.149390@22g2000hsm.googlegro ups.com:
Quote:
I would like to make an SQL that counts the records resulting
from an other SQL:
>
This is the Query resulting the records (31 in my test)
>
SELECT A.customerid FROM A INNER JOIN customers ON
A.customerid = customers.Customerid WHERE
Left([PeriodeID],8)='20070625' AND customers.Companyid=97
GROUP BY A.customerid;
>
>
I would like just one record result with the total count of
the records in this query: 31
I tried things like:
>
SELECT Count(*) FROM (SELECT A.customerid FROM A INNER JOIN
customers ON A.customerid = customers.Customerid WHERE
Left([PeriodeID], 8)='20070625' AND customers.Companyid=97
GROUP BY A.customerid;)
>
But he keeps on giving me an error on the FROM clause
>
Anyone who can help me, probably supper simple, but I gave up
searching and really can't find it.
>
Thanks in advance
>
>
SELECT count(A.customerid)
FROM A
INNER JOIN customers
ON A.customerid = customers.Customerid
WHERE Left([PeriodeID],8)='20070625'
AND
customers.Companyid=97;



--
Bob Quintal

PA is y I've altered my email address.

--
Posted via a free Usenet account from http://www.teranews.com

Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL count not matching the results of perl script count jonathan184 answers 2 November 28th, 2006 01:28 PM
Datagrid and SQL Count Jl_G_0 answers 2 September 19th, 2006 07:05 PM
pivot table sql -- COUNT() not working as expected kumar mcmillan answers 2 November 23rd, 2005 01:13 AM
pivot table sql -- COUNT() not working as expected kumar mcmillan answers 0 November 23rd, 2005 01:13 AM
acc2003: recordcount property or sql count question JMCN answers 1 November 13th, 2005 04:58 AM