Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting fields with SQL 1

Status
Not open for further replies.

SpyPnch

Technical User
Mar 13, 2008
7
US
I have a table that has a check field and a field that has one of two entries. I would like to count the number of each entry minus the total number of check marks. How would I do in SQL?
 
Perhaps:

Code:
SELECT t.X, 
  Count(t.X) AS CountX, 
  Count(t.x)-DSum("Abs(ChkX)","t") AS [CountX-ChkX]
FROM t
GROUP BY t.X

Where X is the field, ChkX is the check field and t is the table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top