Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 DATEDIFF

Author  Topic 

nikoo56
Starting Member

26 Posts

Posted - 2011-12-12 : 20:38:49
I have this SQL statement that shows result in hour.

select DATEDIFF(hour, dt_created, (select min(dt_made) from tblC5ProspectCalls pc2 where pc2.prospect_id = p.prospect_id and callback_rep_id is not null and call_result_id = 3))

I like to show the decimal result something like,
isnull(convert(varchar(30), convert(decimal(10,2), (select datediff(minute, p.dt_created, min(pc.dt_made)) / 60.0

but I m not sure how, anything that I write I get an error.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-12-13 : 00:55:48
can you show full query as we need to see what grouping you're using?
you cant use min() etc over a field unless you apply some kind of group by.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -