October 18, 2010 at 9:11 am
I would like to round off the 2937 values that are returned when running this query. I have been looking through the forums and see how to round a know number but not how to round off the results of a query.
SELECT TSTAMP, [VALUE]
FROM [DDCSupervisor].[dbo].[YASUI_YASU__TON__CALC_YASU__TOTAL__TON__HRS]
WHERE TSTAMP >= DATEADD(ss, +15, DATEADD(mm, DATEDIFF(mm,0,GETDATE()) -1, 0))
AND TSTAMP < DATEADD(ss, +15, DATEADD(mm, DATEDIFF(mm,0,GETDATE()), 0))
ORDER BY TSTAMP
Results:
TSTAMP
2010-09-01 00:15:00.450
VALUE
1.787687
Thanks
October 18, 2010 at 10:35 am
Are you just trying to round the Value column?
If so, have you looked at the T-SQL "Round" function? http://msdn.microsoft.com/en-us/library/ms175003.aspx
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
October 18, 2010 at 11:09 am
Yes I am trying to round off the entire values column. I did look at the link you posted prior to my post. Which is where I am confused. It seems simple to round a known number but I am not sure how to round the entire column of values. I have started building a report project that seems to be able to do it for me.
Thanks
October 18, 2010 at 11:21 am
Where you have "[VALUE]" in your Select statement, put "round([VALUE], 3) as RoundedValue". Change the rounding digit as needed (I picked 3 arbitrarily), and change the column alias to what you like (I picked "RoundedValue" arbitrarily). That should give you what you need.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
October 18, 2010 at 2:54 pm
Thanks. I was overthinking it.
October 18, 2010 at 2:56 pm
You're welcome.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply