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.
| Author |
Topic |
|
Prabhat33
Starting Member
4 Posts |
Posted - 2012-09-19 : 03:37:56
|
| Hi again,i want to group the numbers by dividing it by 60 like this:6/60 should be 161/60 should be 2121/60 should be 3.Thanks. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2012-09-19 : 03:46:34
|
add 60 to it and then divide.assuming that your column is integerSELECT (60 + yourcol) / 60 KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
joshua_caleb
Starting Member
3 Posts |
Posted - 2012-09-19 : 04:17:46
|
| If your data type is a decimal or float, you could use the Ceiling functionSELECT Val1, CEILING(Val1 / 60)Josh |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-19 : 11:52:24
|
quote: Originally posted by khtan add 60 to it and then divide.assuming that your column is integerSELECT (60 + yourcol) / 60 KH[spoiler]Time is always against us[/spoiler]
wont this return 2 for 60 as well?i guess what OP is after is till 60 result should be 1 and from 61 it should be 2 etc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-09-19 : 11:53:23
|
SELECT ((yourcol-1)/60)+1 FROM table ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|