You are here: Problem with SUM « MsSQL Server « IT news, forums, messages
Problem with SUM

Posted by Ray Greene on 10/12/05 12:37

SQL newbie alert...

I have a table with the fields Location, MachineName ,Hours and Date.
(The actual database is more complex but it will do for the purposes of this
post)

I want to return Location, MachineName and the sum of the hours between two
dates. Here is an idea of what I need, although obviously this code doesn't
work.

SELECT Location, MachineName, SUM(Hours)
FROM Table
WHERE Date BETWEEN date1 AND date2

I have experimented with various nested SELECT statements but with no
success. I'm new to SQL and out of my depth already, can anyone explain how
to do this?


Ray Greene.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация