I get the same behavior, and parentheses don't make any difference.
As long as the min or max argument is a mathematical expression,
MySQL uses the second number in the expression as the argument, so
the BETWEEN clause below is the same as
BETWEEN (63000) AND (63000)
I tried this on 3.23.31. Before I had a chance to upgrade, my Windows
box made another suicide attempt, and I have to wait until it comes
back from the psychiatric ward before I can upgrade. Can someone else
confirm that this happens with the most recent version?
Bob Hall
> >Maybe you should try
> >
> >SELECT count(*) FROM bench WHERE year = 95 and
> > -> value BETWEEN (0.7*63000) and (1.3*63000) ;
> >
>
> Hmm -- I thought, yes! But...
>
>mysql> select count(*) from bench where year = 95 and
> -> value between (0.7*63000) and (1.3*63000);
>+----------+
>| count(*) |
>+----------+
>| 0 |
>+----------+
>1 row in set (0.08 sec)
>
> I can, of course use the non-BETWEEN syntax, though this problem would
>steer me away from BETWEEN from now on...
>
>Thanks
>
>
>
>
>----- Original Message -----
>From: <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Saturday, February 03, 2001 3:53 AM
>Subject: BETWEEN problem?
>
>
> > Can anyone explain the following results to me?
> >
> > I am trying to find all values +/- 30% from a number...
> > value is declared as: | value | int(10) unsigned
> > Note that 1.3*63000 is 81900...
> >
> > The first two are apparently correct:
> >
> > mysql> SELECT count(*) FROM bench WHERE year = 95 and
> > -> value >= .7*63000 and value <= 1.3*63000 ;
> > +----------+
> > | count(*) |
> > +----------+
> > | 115 |
> > +----------+
> > 1 row in set (0.10 sec)
> >
> > mysql> SELECT count(*) FROM bench WHERE year = 95 and
> > -> value >= .7*63000 and value <= 81900 ;
> > +----------+
> > | count(*) |
> > +----------+
> > | 115 |
> > +----------+
> > 1 row in set (0.08 sec)
> >
> > These next two should give the same result, but...
> >
> > mysql> SELECT count(*) FROM bench WHERE year = 95 and
> > -> value BETWEEN .7*63000 and 81900 ;
> > +----------+
> > | count(*) |
> > +----------+
> > | 47 |
> > +----------+
> > 1 row in set (0.08 sec)
> >
> > mysql> SELECT count(*) FROM bench WHERE year = 95 and
> > -> value BETWEEN .7*63000 and 1.3*63000 ;
> > +----------+
> > | count(*) |
> > +----------+
> > | 0 |
> > +----------+
> > 1 row in set (0.08 sec)
> >
> >
> > Thanks
> >
> >
>
>---------------------------------------------------------------------
>Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
>To request this thread, e-mail <[EMAIL PROTECTED]>
>To unsubscribe, e-mail
><[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Know thyself? Absurd direction!
Bubbles bear no introspection. -Khushhal Khan Khatak
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php