• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 218
  • Last Modified:

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?
0
rgranlund
Asked:
rgranlund
1 Solution
 
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
 
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now