MOD

Started by Tyler Woodover 25 years ago4 messagesgeneral
Jump to latest
#1Tyler Wood
electric_pancake@yahoo.com

Hello,
I'm updating an existing postgres database, and using
perl with dbi to
access it.

Everything works fine,
I'm just not sure what this MOD command means.
Not asking you to figure it out in this context,
but just what does MOD do?

$sqh = $dbh->prepare("select
name,namelink,address,city,state,zip,email
from company where MOD(nextscreen,2)=1 order
by $sort_selection;");
$sqh->execute();

thank you,

Tyler Wood
twood@uwm.edu

__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail ��� Free email you can access from anywhere!
http://mail.yahoo.com/

#2Chris Bitmead
chrisb@nimrod.itg.telstra.com.au
In reply to: Tyler Wood (#1)
Re: MOD

MOD is the remainder after division.

MOD(10, 3) = 1
MOD(11, 3) = 2
MOD(12, 3) = 0
MOD(13, 3) = 1

etc.

Tyler Wood wrote:

Show quoted text

Hello,
I'm updating an existing postgres database, and using
perl with dbi to
access it.

Everything works fine,
I'm just not sure what this MOD command means.
Not asking you to figure it out in this context,
but just what does MOD do?

$sqh = $dbh->prepare("select
name,namelink,address,city,state,zip,email
from company where MOD(nextscreen,2)=1 order
by $sort_selection;");
$sqh->execute();

thank you,

Tyler Wood
twood@uwm.edu

__________________________________________________
Do You Yahoo!?
Get Yahoo! Mail - Free email you can access from anywhere!
http://mail.yahoo.com/

#3Len Morgan
len-morgan@crcom.net
In reply to: Chris Bitmead (#2)
Re: MOD

Not asking you to figure it out in this context,
but just what does MOD do?

$sqh = $dbh->prepare("select
name,namelink,address,city,state,zip,email
from company where MOD(nextscreen,2)=1 order
by $sort_selection;");
$sqh->execute();

I believe it's just trying to figure out if "nextscreen" is odd or even. 1
would odd, 0 even.

len morgan

#4John McKown
jmckown@prodigy.net
In reply to: Tyler Wood (#1)
Re: MOD

On Mon, 17 Jul 2000, Tyler Wood wrote:

name,namelink,address,city,state,zip,email
from company where MOD(nextscreen,2)=1 order

MOD is short for MODulus, which means the remainder after division. In
the above, it divides nextscreen by 2. If the remainder is 1, then it
selects the row. I.e. "If nextscreen is odd"

John McKown