"Chris" <[EMAIL PROTECTED]> wrote:
> 
>        Quick question... I need to be able to send a query like:
> 
> select cd,fid,s_from,s_to from ima where '3355443200' between s_to and
> s_from
> 
> Thats fine and all, but when I get my results I pull 2 records:
> 
> MA smith 335544320 352321535
> BS mango 3355443200 3355445247
> 
> I must only return the 1 record ( 3355443200 ), but it appears that the
> zero's are throwing it off.

If s_to and s_from have string type, value are compared as strings. Remove quotes 
around 3355443200.

mysql> select '3355443200' between '335544320' and '352321535';
+--------------------------------------------------+
| '3355443200' between '335544320' and '352321535' |
+--------------------------------------------------+
|                                                1 |
+--------------------------------------------------+
1 row in set (0.00 sec)

mysql> select 3355443200 between '335544320' and '352321535';
+------------------------------------------------+
| 3355443200 between '335544320' and '352321535' |
+------------------------------------------------+
|                                              0 |
+------------------------------------------------+
1 row in set (0.00 sec)


> 
> How can I select only the EXACT record??




-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com





-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to