Connecting Tech Pros Worldwide Help | Site Map

SQL Count(*)

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 10th, 2007, 03:15 PM
davy.cox@gmail.com
Guest
 
Posts: n/a
Default SQL Count(*)

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, 05:25 PM
Yitzak
Guest
 
Posts: n/a
Default 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, 01:15 PM
Bob Quintal
Guest
 
Posts: n/a
Default 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

 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,840 network members.