Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I have been a grateful member of this site for several years. I love this site and refer everyone to it!..."

Geography

Where in the world do Tek-Tips members come from?

Multiply Count of Rows by Value Held in Field

zulu1ghz (TechnicalUser)
25 Feb 10 15:12
Hi All,

I'm trying to work out if this is possible as all my current attempts at this have failed.

I have written a query which shows me how many people have attended a course, one of the columns counts the number of people and returns the count correctly.

Now another one of my fields holds the course duration in days, i.e 1,2,3 etc. What I want to be able to do is create an expression that will multiply the count of people on the course by the duration giving me a total of man days consumed by staff attending the course.

Could anybody point me in the right direction of this expression or if it's possible at all. I can do a count and then multiple it by a number. For example:-

select count(*)* 200 from ps_training will work.

However if i include other fields in the select i receive a message about it being not a single group function.

Thanks in advance.
Steve
jaxtell (Programmer)
25 Feb 10 15:15
you need to use GROUP BY

-----------------------------------------
I cannot be bought.  Find leasing information at http://www.joshaxtell.com/

SkipVought (Programmer)
25 Feb 10 15:16


hi,

Quote:

However if i include other fields in the select i receive a message about it being not a single group function.

CODE

select count(*)* 200 , [some other field]
from ps_training
Group By [some other field]
 

Skip,

glassesJust traded in my old subtlety...
for a NUANCE!tongue

zulu1ghz (TechnicalUser)
25 Feb 10 16:01
Thanks guys for the prompt response.

Worked a treat.

Steve

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close