Dear All,

I have forgot how to do this, counting the number of record for each
customer appear in table sales. I make this,

select customer, count() as total from sales group by alltrim(customer)

The message keep popping up that the statement has missing expression.
Please kindly help me out.
Many thanks.

Regards,
Wandy Tang

Re: quick question on sql by Anthony

Anthony
Tue Feb 03 23:13:28 CST 2004

"Wandy Tang" <anonymous@discussions.microsoft.com.invalid> [WA] wrote:

>Dear All,
>
>I have forgot how to do this, counting the number of record for each
>customer appear in table sales. I make this,
>
>select customer, count() as total from sales group by alltrim(customer)

Try: select customer, count() as total from sales group by alltrim(customer)

I'm not sure that the alltrim(customer) will work. If you still have a problem,
try it without the alltrim.

regards - anthony shipley

look, ma - no .sig

Re: quick question on sql by Fred

Fred
Tue Feb 03 23:15:52 CST 2004

Leave out the ALLTRIM(). You can't use a function on a GROUP BY. Also, you
need COUNT(*) AS Total.

Fred
Microsoft Visual FoxPro MVP


"Wandy Tang" <anonymous@discussions.microsoft.com.invalid> wrote in message
news:eFuHMjt6DHA.1040@TK2MSFTNGP10.phx.gbl...
> Dear All,
>
> I have forgot how to do this, counting the number of record for each
> customer appear in table sales. I make this,
>
> select customer, count() as total from sales group by alltrim(customer)
>
> The message keep popping up that the statement has missing expression.
> Please kindly help me out.
> Many thanks.
>
> Regards,
> Wandy Tang
>
>



Re: quick question on sql by Agnes

Agnes
Wed Feb 04 02:25:39 CST 2004

try this
select customer,count(customer) as noofcustomer from sales_table group by
customer

From agnes


"Wandy Tang" <anonymous@discussions.microsoft.com.invalid> ¦b¶l¥ó
news:eFuHMjt6DHA.1040@TK2MSFTNGP10.phx.gbl ¤¤¼¶¼g...
> Dear All,
>
> I have forgot how to do this, counting the number of record for each
> customer appear in table sales. I make this,
>
> select customer, count() as total from sales group by alltrim(customer)
>
> The message keep popping up that the statement has missing expression.
> Please kindly help me out.
> Many thanks.
>
> Regards,
> Wandy Tang
>
>