Question : Counting number of rows

Hi experts,

I've got a Category column and a subcategory column like this:

Category      SubCategory
    A                      aa
    A                      bb
    A                      cc
    A                      dd
    A                      ee
    B                      ff
    B                      gg
    B                      hh
    B                      ii
   
What would be the query that will give me back a count of the number of occurances of A and B returned in a 3rd column?
So I should have a count of 5 for Category A and 4 for Category B

Thanks.

Answer : Counting number of rows

I'm guessing you are calling Windows API to copy files or similar, so you need only PChar and string types, and Delphi compiler will decide, according to the version, the correct kind and correct API version it will use.

With Delphi <2009 :
String = AnsiString
(P)Char = (P)AnsiChar
and all windows API called are the ANSI version , ex :
CopyFile = CopyFileA

With Delphi >=2009
String = WideString
Char = WideChar
and all windows API called are the Wide version


so, your code should be made to compile with all versions, without playing too much with other types except when you don't have choice
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
Var
 cDestino, cOrigem : PChar;
 sFile, sPath, sDiaSemana :String;
 iProgBar: Integer;
and;

  sFile := 'PedItem.db';
  cOrigem := strtopchar ( sPath+'\'+sFile );
  cDestino:= strtopchar ( 'C:\Back-up_AcxSir\'+sDiaSemana+sFile ); 
  CopyFile( cOrigem , cDestino , False ); 


Note that you can convert String to PChar with just a cast in the way aflarin shown for AnsiString & PAnsiChar. 
So you can even call your function in one line

  CopyFile( PChar( sPath+'\'+sFile ), PChar( 'C:\Back-up_AcxSir\'+sDiaSemana+sFile ) , False ); 
Random Solutions  
 
programming4us programming4us