Search code examples
c#mysql

C# Mysql select value where a and b are dividable


I have been googling for long time, so I decided to get help from here I am trying to find Row where column A value is dividable from B value. Help me out.

It should look like this:

string select = "Select Suma FROM ivykiai WHERE (`Ivikio diena` ~?Is dividable?~ Periodiskumas_d";

What should I write in ~?Is dividable?~ ?


Solution

  • You just need the modulo operator, %.

    When a%b the a is divided by b.

    This in term of your code is can be done like below:

    string select = "Select Suma FROM ivykiai WHERE `Ivikio diena`%Periodiskumas_d=0";
    

    For further documentation about this operator, please have a look here.