SQL: remainder of a division

Hi everyone!!!

Is it possible to get the remainder of a division in an SQL statement? How do we do that?

Basically, in my WHERE clause, I want the record to have one of its fields divisible by a value that I enter dynamically
and that the remainder of the division of this field by the entered value is 0...

Thanks in advance :o)

4 answers

  1. Whoa, sorry for the useless question! I wasn't using the right way of the mod function!

    For those who are interested, it's like this:
    number1 mod number2 to get the remainder of the division.
    0
    1. For those interested, it's like this:
      number1 mod number2 to get the remainder of the division
      - on SQL Server 2000 the MOD function is for example ( X % Y)
      0
      1. SQL2000 ... it poses a problem for me ...
        If (X % Y) = the remainder of the division ...
        if I take a calculator and I do 12/5, I get 2.4
        So if I do select (12 % 5) I should get 4
        Then how is it that I get 2 ???
        1
        1. 12 = 5*2 + 2, the remainder of the division is this +2. But 0.4 is indeed equal to 2 divided by 5, there is a connection.
          0
      2. the remainder is whole, your .4 is fractional
        (note: .4 * 5 => 2)
        0