Haminteu Haminteu - 5 months ago 14
SQL Question

Select every ten steps SQL

I have the following table:


----------------------------------------------
oNumber oValue1
----------------------------------------------
1 54
2 44
3 89
4 65
ff.
10 33
11 22
ff.
20 43
21 76
ff.
100 45


I want to select every 10 value in
oNumber
. So the result should be:


----------------------------------------------
oNumber oValue1
----------------------------------------------
10 33
20 43
ff.
100 45


Also,
oNumber
is not a sequence number. It's just a value. Even it isn't a sequence number, 10, 20, 30 and so on will always appear under
oNumber
field.


Does anyone know how is the tsql for this case?

Thank you.

Answer
select * from table where oNumber % 10 = 0

https://msdn.microsoft.com/en-us/library/ms190279.aspx

Comments