Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Need to count how many clients enter
Sat, Mar 18 2006 2:23 PMPermanent Link

Carlos
I got a transaction file where one of the fields is the date and another is the
client code. I want to count how many clients I have per day.
Sat, Mar 18 2006 7:31 PMPermanent Link

Eryk Bottomley
Carlos,

> I got a transaction file where one of the fields is the date and another is the
> client code. I want to count how many clients I have per day.

I don't think DBISAM supports "SELECT COUNT(DISTINCT Column) FROM Table"
yet so you will probably need to use something like:

SELECT DISTINCT CLIENT_ID FROM ATable WHERE DateField = ADate

....and then read Query.RecordCount to get the 'clients per day' count.

Eryk
Sun, Mar 19 2006 5:31 AMPermanent Link

Carlos
Is there a way to make something like this?

SELECT T.DATE, DISTINCT T.CLIENTnum FROM Table T

I want all the transaction with date eliminating the duplicates clients



CARLOS



Eryk Bottomley <no@way.com> wrote:

Carlos,

> I got a transaction file where one of the fields is the date and another is the
> client code. I want to count how many clients I have per day.

I don't think DBISAM supports "SELECT COUNT(DISTINCT Column) FROM Table"
yet so you will probably need to use something like:

SELECT DISTINCT CLIENT_ID FROM ATable WHERE DateField = ADate

....and then read Query.RecordCount to get the 'clients per day' count.

Eryk
Sun, Mar 19 2006 7:14 AMPermanent Link

Michael Baytalsky

I think, this can only be done with temp table.

SELECT DISTINCT T.DATE, T.CLIENTnum
INTO Memory\TempTable
FROM Table T;

CREATE UNIQUE INDEX ON Memory\TempTable(DATE, CLIENTnum);

SELECT T.Date, Count(T.CLIENTnum) from Memory\TempTable group by T.Date;

Later on you will have to drop the TempTable:
DROP Memory\TempTable;

You can try to use subselect, but the above method will work faster.

Regards,
Michael


Carlos wrote:
> Is there a way to make something like this?
>
> SELECT T.DATE, DISTINCT T.CLIENTnum FROM Table T
>
> I want all the transaction with date eliminating the duplicates clients
>
>
>
> CARLOS
>
>  
>
> Eryk Bottomley <no@way.com> wrote:
>
> Carlos,
>
>> I got a transaction file where one of the fields is the date and another is the
>> client code. I want to count how many clients I have per day.
>
> I don't think DBISAM supports "SELECT COUNT(DISTINCT Column) FROM Table"
> yet so you will probably need to use something like:
>
> SELECT DISTINCT CLIENT_ID FROM ATable WHERE DateField = ADate
>
> ....and then read Query.RecordCount to get the 'clients per day' count.
>
> Eryk
>
Image