Query Syntax

I need to query a field(Hours) in my DB that has numeric values in each entry,  However, I am not sure how to add up all of the numbers that are returned by the query?  Can someone please point me to the correct tutorial or offer an example?
LVL 7
rgranlundAsked:
Who is Participating?
 
Rajkumar GsSoftware EngineerCommented:
If you mean to sum up all the values in query, you can use SUM

eg: SELECT SUM(yourcolumn) FROM TABLE

Raj
0
 
mnasr333Commented:
Typical Date Query
How to query a table with a selection on a datetime column, for example, find all items for the date 2006-01-14. This isn’t really a script, but it is one of the most common questions about datetime.

Select
      *
from
      NyTable
Where
      MyDateColumn >=  '20060114' and
      MyDateColumn <   '20060115'
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
awking00Commented:
See attached.
comments.txt
0
 
Ray PaseurCommented:
@awking00:  It's easier for us to use the site if we have more information in clear text instead of in attached files.

<quote>
What is the data type of the Hours field? Are you looking for a sum of all the hours in the table or a sum for a given set of records? If the first, RajkumarGS gave you the answer. If the second, you will need to do a group by. For example, if you wanted the total hours worked by each employee, you would select employee_id, count(*) from table group by employee_id. Perhaps some sample data and the expected results might better clarify your issue.
</quote>

Regarding the last sentence, I could not agree more!
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_7830-A-Quick-Tour-of-Test-Driven-Development.html
0
 
awking00Commented:
Ray_Paseur,
Beleive me, if I could do that, I would. All too frequently attachments are the only way my responses will go through. I tried to initially respond in clear context and I apologize for any inconvenience. I can only say that it is extremely inconvenient for me to have to respond in this way.
0
 
Ray PaseurCommented:
Wonder why that is -- I see a comment form and it's for me to type responses into the form.  Have you told EE about the issue?
0
 
awking00Commented:
When EE upgraded their site (it's been, what, about 2 years ago), I started having the problem and mentioned it a number of times, but there seemed to be no solution. It seems the problem may be with my extremely restrictive firewall.
0
 
Ray PaseurCommented:
10-4.  I have no firewall.  Maybe there is a way to tell your firewall to whitelist the domain?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.