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

Re: Help-->SQL Statement in vb6 for getting total of Field 80 80

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

Re: Help-->SQL Statement in vb6 for getting total of Field 80 80

Hi,

Sorry, Remove Distinct In last 2 statements.

Re: Help-->SQL Statement in vb6 for getting total of Field 80 80

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.