List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:September 8 1999 6:50am
Subject:Re: select question
View as plain text  
On Tue, 1999-09-07 15:58:55 -0500, Manuel Coral A. wrote:
> Hello again, my code columns type is varchar in both
> cases, as I saw you, I don't have any problem if  the
> code value is 58, but with 000058 I don't have any
> result.
> My mysql version 3.22.25, and I runing this on the Linux
> slackware 2.0.34 kernel

Manuel, I've no idea why you get different results with
> select * from transaction where code=000058;
compared to
> select * from transaction where code=58;

I just can show you, what I did for a test:

mysql> CREATE TABLE tmp ( code VARCHAR(30) );
mysql> INSERT INTO tmp VALUES ('58');
mysql> INSERT INTO tmp VALUES ('000058');
mysql> SELECT * FROM tmp;
+--------+
| code   |
+--------+
| 58     |
| 000058 |
+--------+
mysql> SELECT * FROM tmp WHERE code=58;
+--------+
| code   |
+--------+
| 58     |
| 000058 |
+--------+
mysql> SELECT * FROM tmp WHERE code=000058;
+--------+
| code   |   /* 000058 is just a number, */
+--------+   /* so leading zeros don't   */
| 58     |   /* make any difference and  */
| 000058 |   /* it's just the number 58  */
+--------+
mysql> SELECT * FROM tmp WHERE code='58';
+------+
| code |
+------+
| 58   |
+------+
mysql> SELECT * FROM tmp WHERE code='000058';
+--------+
| code   |
+--------+
| 000058 |
+--------+

This is all exactly as it's supposed to be.

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
select questionManuel Coral A.7 Sep
  • Re: select questionsinisa7 Sep
    • Re: select questionManuel Coral A.8 Sep
      • Re: select questionMartin Ramsch8 Sep
RE: select questionManuel Coral A.8 Sep
  • Re: select questionRicardo T. Saito9 Sep
  • Re: select questionStefan Tryggvason9 Sep