The Count(*) aggregation is bound to the Group By section of the query:

Ex 1:
Select Columns:         Province, Type, Sub_Type, Count(*) "COUNT"
>From Tables:           National_Health_Facility_List_
Group By Columns:       Province, Type, Sub_Type
Order By Columns:
into Table Named:       Count_Test

Result: Here you get a list that looks like this:
Province, Type, Sub_Type, COUNT
What it tells you is how many records there is for each combnation of Province, Type 
and Sub_Type

Ex 2:
Select Columns:         Province, Count(*) "COUNT"
>From Tables:           National_Health_Facility_List_
Group By Columns:       Province
Order By Columns:
into Table Named:       Province_Count_Test

Result: Here you get a list that looks like this:
Province, COUNT
What it tells you is how many records there is for each combnation of Province

It is the Group By section that defines what you are actually counting. Also have in 
mind that you almost never should have other columns in the Select Columns sections 
that those mentioned in the Group By section.

Peter Horsbøll Møller
GIS Developer
Geographical Information & IT

COWI A/S
Odensevej 95
DK-5260 Odense S
Denmark
 
Tel     +45 6311 4900
Direct  +45 6311 4908
Mob     +45 5156 1045
Fax     +45 6311 4949
E-mail  [EMAIL PROTECTED]
http://www.cowi.dk

*****CHANGE OF ADDRESS - COWI's offices in Odense are now under the same roof*****
On December 8th. 2003, Geographical Information & IT moved from Rugaardsvej 55, 5000 
Odense C to Odensevej 95, 5260 Odense S. 
Please note our new telephone, direct and telefax numbers.



> -----Original Message-----
> From: Norman Mabunda [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, January 15, 2004 8:14 AM
> To: [EMAIL PROTECTED]; 
> [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: Re: MI-L SQL Query
> 
> 
> I have a table that I wanted to do a similiar thing to what 
> Andrew Tracey wanted to do.
> 
> Please see the attachment to see what I did:
> 
> Select Columns:      Province, Type, Count(Sub_Type) "5"
> 
> From Tables:    National_Health_Facility_List_
> 
> Where Condition:      
> 
> Group By Columns:     Sub_Type
> 
> Order By Columns:
> 
> into Table Named:      Count_Test
> 
> MI does not want any field name other than * within the Count 
> brackets. When I put "Count(*)" and then "5" after that, 5 
> becomes a count field name, not the number of records I need 
> a count for.
> 
> Now the question is: Do we always have to get the count of 
> all the records, not the number of records we want to see? If 
> the answer is no, then how do we do it?
> 
> Regards,
> 
> 
> 
> 
> 
> 
> 
> >>> "Steve Kalmbach" <[EMAIL PROTECTED]> 01/14/04 08:38PM >>>
> Yes, the query would go something like this:
> 
> Select WARD_NO, TENURE_TYPE, Count(TENTURE_TYPE) "How_Many" 
> From MY_TABLE GROUP BY WARD_NO, TENURE_TYPE ORDER BY WARD_NO, 
> TENURE_TYPE Into RESULTS_TABLE
> 
> If you are using the SQL select dialog, the first line above 
> is the 'Select Columns', the second line is the 'from 
> Tables', the third line is the 'Group by Columns', and the 
> fourth line is the 'Order by Columns'.
> 
> 
> Steve Kalmbach
> Systems Department
> The Grand Rapids Press
> 616-222-5498
> [EMAIL PROTECTED]
> 
> 
> >>> "Andrew Tracey" <[EMAIL PROTECTED]> 01/14/2004
> 11:50:06 AM >>>
> Dear All
> 
> I have a MapInfo table which comprises ward reference no and 
> tenure type. I am trying to produce a query that will list 
> the 20 wards and a count of how many of each tenure type 
> there are in each ward. I want one browser with all results 
> on. Is this possible.
> 
> Thanks in advance
> Andrew Tracey
> Information Support Officer
> Corporate Information
> Corporate Growth and Focus
> Corporate Development
> South Tyneside Council
> Westoe Road
> South Shields
> NE33 2RL
> 
> Tel: 0191 4247561
> E-Mail : [EMAIL PROTECTED] 
> **************************************************************
> **********************************
> Please do not print this e-mail if you can help it - and help 
> protect the environment.
> **************************************************************
> **********************************
> This Message may contain confidential information and is 
> protected by copyright. If you receive it in error please 
> notify us and delete it without making use of or copying it. 
> The addressee and other employees within the Council may read 
> and copy any e-mail reply to this message and other e-mails 
> you send to us. Whilst we use virus checking procedures we 
> accept no liability for viruses and recipients 
> must rely on their own virus checking procedures.
> **************************************************************
> **********************************
> The Council's web site address is www.southtyneside.info 
> 
> ---------------------------------------------------------------------
> List hosting provided by Directions Magazine | 
> www.directionsmag.com | To unsubscribe, e-mail: 
> [EMAIL PROTECTED] 
> For additional commands, e-mail: 
> [EMAIL PROTECTED]
> 
> Message number: 9883
> 
> 

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 9893

Reply via email to