Connecting Tech Pros Worldwide Forums | Help | Site Map

count in select query

Newbie
 
Join Date: May 2007
Posts: 8
#1: May 7 '07
I created a database with registration information and my query works well on simply the count of people registered. Instead of count, however, my clients wants number of spaces available (i.e. 10-count)... how do I write that query?

Thanks!!!!!

JConsulting's Avatar
Expert
 
Join Date: Apr 2007
Location: Houston
Posts: 601
#2: May 7 '07

re: count in select query


Quote:

Originally Posted by jslssuze

I created a database with registration information and my query works well on simply the count of people registered. Instead of count, however, my clients wants number of spaces available (i.e. 10-count)... how do I write that query?

Thanks!!!!!

Can you post your SQL for your query here?
J
Newbie
 
Join Date: May 2007
Posts: 8
#3: May 7 '07

re: count in select query


Quote:

Originally Posted by jslssuze

I created a database with registration information and my query works well on simply the count of people registered. Instead of count, however, my clients wants number of spaces available (i.e. 10-count)... how do I write that query?

Thanks!!!!!

This is what the SQL query looks like now

SELECT DISTINCTROW Count(Results.[Webinars_Computer-Basics]) AS [CountOfWebinars_Computer-Basics], Count(Results.[Webinars_Introduction-to-TASBiller]) AS [CountOfWebinars_Introduction-to-TASBiller], Count(Results.[Webinars_Mystery-Behind-the-Numbers]) AS [CountOfWebinars_Mystery-Behind-the-Numbers], Count(Results.[Webinars_Custom-Invoices]) AS [CountOfWebinars_Custom-Invoices]
FROM Results;
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,875
#4: May 8 '07

re: count in select query


Quote:

Originally Posted by jslssuze

This is what the SQL query looks like now

SELECT DISTINCTROW Count(Results.[Webinars_Computer-Basics]) AS [CountOfWebinars_Computer-Basics], Count(Results.[Webinars_Introduction-to-TASBiller]) AS [CountOfWebinars_Introduction-to-TASBiller], Count(Results.[Webinars_Mystery-Behind-the-Numbers]) AS [CountOfWebinars_Mystery-Behind-the-Numbers], Count(Results.[Webinars_Custom-Invoices]) AS [CountOfWebinars_Custom-Invoices]
FROM Results;

Just try ...
Expand|Select|Wrap|Line Numbers
  1. SELECT 10 - Count(Results.[Webinars_Computer-Basics]) AS [Webinars_Computer-Basics_Available], 
  2. 10 - Count(Results.[Webinars_Introduction-to-TASBiller]) AS [Webinars_Introduction-to-TASBiller_Available], 
  3. 10 - Count(Results.[Webinars_Mystery-Behind-the-Numbers]) AS [Webinars_Mystery-Behind-the-Numbers_Available], 
  4. 10 - Count(Results.[Webinars_Custom-Invoices]) AS [Webinars_Custom-Invoices_Available]
  5. FROM Results;
JConsulting's Avatar
Expert
 
Join Date: Apr 2007
Location: Houston
Posts: 601
#5: May 8 '07

re: count in select query


Looks good to me. Do you expect to handle any negative numbers?
Newbie
 
Join Date: May 2007
Posts: 8
#6: May 8 '07

re: count in select query


Quote:

Originally Posted by JConsulting

Looks good to me. Do you expect to handle any negative numbers?

It worked great! I don't know if there will be negative numbers.. only if someone registers when the numbers are showing 0
Reply