Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what is wrong with my query?

Status
Not open for further replies.

ii128

Programmer
May 18, 2001
129
US
SELECT name, datediff("s", start_time, stop_time) /3600, count(name)
FROM usertime group by name

Help!!!! what is wrong with my query?
 

Remove the " around the s in the datediff function when using T-SQL in SQL Server. You should add a decimal to the 3600 to calculate fractions of hours.

I would also add an alias for the calculated time and count.

SELECT
name,
datediff(s, start_time, stop_time) / 3600. As Hours,
count(name) As Cnt
FROM usertime
GROUP BY name Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top