Round up or down to nearest 5, but not 10


R

Ryan Fisher

Hello,
This might seem rather odd request, but I have a set of spatial corrdinates in a database with the degrees, minutes and seconds in separate fields. We need to identify the center of each 10 minute block that the location falls within. So what I'm trying to do is develop a query that takes the minutes field (anything between 0 and 59) and rounds the number up or down to 5 (e.g., if 12 then it rounds it up to 15, if 18 then rounds it down to 15, if 22 then 25, etc..). I'm really in the dark on this one!
Thanks for any help!
Ryan
 
Ad

Advertisements

R

Ron Weiner

Ryan Fisher pretended :
Hello,
This might seem rather odd request, but I have a set of spatial corrdinates
in a database with the degrees, minutes and seconds in separate fields. We
need to identify the center of each 10 minute block that the location falls
within. So what I'm trying to do is develop a query that takes the minutes
field (anything between 0 and 59) and rounds the number up or down to 5
(e.g., if 12 then it rounds it up to 15, if 18 then rounds it down to 15, if
22 then 25, etc..). I'm really in the dark on this one! Thanks for any help!
Ryan
If it were me, rather than to attempt writing a Function, I'd do it by
creating a new table with two Columns (Degree & RoundedDegree).
Pipuklate the table with 60 rows (0 to 59) in the Degree Column and the
(pre)computed value in the Rounded Degree Column.

Now your query can get the rounded result by using a simple Inner Join
on your existing table and the new table. Easy Peasy:)

Rdub
 
Ad

Advertisements

R

Ron Weiner

Ron Weiner submitted this idea :
Ryan Fisher pretended :

If it were me, rather than to attempt writing a Function, I'd do it by
creating a new table with two Columns (Degree & RoundedDegree). Pipuklate
the table with 60 rows (0 to 59) in the Degree Column and the (pre)computed
value in the Rounded Degree Column.

Now your query can get the rounded result by using a simple Inner Join on
your existing table and the new table. Easy Peasy:)

Rdub
Sheesh...
Pipuklate = Populate

Rdub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top