By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,905 Members | 2,001 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,905 IT Pros & Developers. It's quick & easy.

count in select query

P: 8
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!!!!!
May 7 '07 #1
Share this Question
Share on Google+
5 Replies


JConsulting
Expert 100+
P: 603
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
May 7 '07 #2

P: 8
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;
May 7 '07 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
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;
May 8 '07 #4

JConsulting
Expert 100+
P: 603
Looks good to me. Do you expect to handle any negative numbers?
May 8 '07 #5

P: 8
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
May 8 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.