Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mod operator

Status
Not open for further replies.

shaminda

Programmer
Jun 9, 2000
170
US
I have some numbers<br>13, 34, 12, 36, 8, 18, 49<br><br>I want to run a query that returns the folling<br><br>12, 36, 18 <br>which are all divisible by 6. I know how to do it in Visual Basic using the mod operator or / operator. But I want to do it in SQL.<br>&nbsp;
 
SQL uses the &quot;%&quot; sign as the modulo operator.&nbsp;&nbsp;A typical SQL statement might be something like: &quot;select 13 % 6&quot; for which the result would be 1.<br><br>Hope This Helps
 
Oracle uses MOD function, you can use this:<br>SELECT nvalue FROM your_table WHERE MOD(nvalue,6)=0;<br>Good luck! <p>Eduard Stoleru<br><a href=mailto:e_stoleru@yahoo.com>e_stoleru@yahoo.com</a><br><a href= > </a><br>
 
This might work: -<br><br>select repairno&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>from wordlines_hist&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>where repairno = int2(repairno/6) * 6; <p>Ged Jones<br><a href=mailto:gedejones@hotmail.com>gedejones@hotmail.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top