473,379 Members | 1,283 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

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

Jul 10 '07 #1
2 2917
On 10 Jul, 16:08, davy....@gmail.com wrote:
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);

Jul 10 '07 #2
da******@gmail.com wrote in
news:11**********************@22g2000hsm.googlegro ups.com:
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

Jul 11 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Ling Lee | last post by:
Hi all. I'm trying to write a program that: 1) Ask me what file I want to count number of lines in, and then counts the lines and writes the answear out. 2) I made the first part like this: ...
6
by: Geetha | last post by:
I searched in the Oracle documents what count (1) meant and I could not find an answer. Can some one explain what Oracle does internally when use count (1) VS count (*). Thank you very much in...
1
by: JD | last post by:
Hi guys I'm trying to write a program that counts the occurrences of HTML tags in a text file. This is what I have so far: #include <stdio.h> #include <stdlib.h> #include <string.h> ...
5
by: Eric Johannsen | last post by:
I have a simple object that inherits from CollectionBase and overrides the Count property: namespace MyTest { public class CollTest : System.Collections.CollectionBase { public override int...
23
by: Gary Wessle | last post by:
Hi I have a vector<charwhich looks like this (a d d d a d s g e d d d d d k) I need to get the biggest count of consecutive 'd'. 5 in this example I am toying with this method but not sure if...
1
by: heckstein | last post by:
I am working in Access 2002 and trying to create a report from our company's learming management system. I am not a DBA and most of my SQL knowledge has been self taught through trial and error. I...
22
by: MP | last post by:
vb6,ado,mdb,win2k i pass the sql string to the .Execute method on the open connection to Table_Name(const) db table fwiw (the connection opened via class wrapper:) msConnString = "Data Source="...
3
by: Auddog | last post by:
I have the following query that works in mysql: select id, order_no, price, count(item_no), sum(price) from production WHERE item_no = '27714' group by item_no; When I setup my query in php,...
7
by: Chris | last post by:
I am trying to increase/decrease the value of $_SESSION by 1 after clicking on a link e.g index.php?gotoWk=nxtWk and index.php? gotoWk=lstWk. I'm sure you will get the drift if you look at the code...
1
by: jlt206 | last post by:
This code <?php include("counter.php")?> on the webpage produces the count number. (function code below) I want to place the current number into a variable $MemberNo or into a FormField to be sent...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.