Hi Everyone:*
I am working on Database project using DAO. Now I got a problem in counting all the data from one Field:-/ . Please help Me in this problem.
:confused: And Tell Me how can I get the total of any field by using SQL STATEMENT?
Thanks In Advance

Hi,

Use This Query:
For Distinct Count:
Select Distinct Count(myfield) From Mytable

For Number Of Rrcords:
Select Distinct Count(*) From Mytable

For Sum:
Select Distinct Sum(amt_field) From Mytable


Regards
Veena

Hi,

Sorry, Remove Distinct In last 2 statements.

Hi,

Sorry, Remove Distinct In last 2 statements.

It may also give error.

For totalling a field always use a place holder using the key word AS

eg.

"SELECT SUM(myField) AS TtldField from mytable;"

regards
AV Manoharan