Bug #3340 Select statement returns a "zero" value under certain condition

Submitted: 30 Mar 2004 21:37 Modified: 1 Apr 2004 6:00
Reporter: Jose Ostos Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.18 OS:Windows (Windows XP Pro)
Assigned to: CPU Architecture:Any

[30 Mar 2004 21:37] Jose Ostos
Description:
I Execute the following query and get the value 0 (zero) on the second column when I should be getting a descripcion according to the "marcas" Table. IF I Change the name of the resulting second column, it displays the result correctly. Attached I send you the tables I am using.

I am using MySql windows version 4.0.18-nt.

Any help or suggestion is welcome.

**** erroneous  result
SELECT DISTINCT m.Marca Clave, m.NomMarca Marca
FROM zz_JAO_tmpcrea6 a 
LEFT JOIN Marcas m ON a.Marca=m.Marca 
ORDER BY Clave

**** correct result (but not the resulting column name I want)
SELECT DISTINCT m.Marca Clave, m.NomMarca Marc
FROM zz_JAO_tmpcrea6 a 
LEFT JOIN Marcas m ON a.Marca=m.Marca 
ORDER BY Clave

How to repeat:
Put the attached tables in a database and execute the mentioned query.

Suggested fix:
There must be somithing in the query tht is confusing the parser
[30 Mar 2004 21:58] Jose Ostos
Tables to recreate bug

Attachment: BugSample.zip (application/x-zip-compressed, text), 3.98 KiB.

[30 Mar 2004 21:59] Jose Ostos
corrected the Mysql server version
[31 Mar 2004 15:46] MySQL Verification Team
C:\mysql\bin>mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; o
Your MySQL connection id is 1 to server version: 4.0

Type 'help;' or '\h' for help. Type '\c' to clear th

mysql> SELECT DISTINCT m.Marca Clave, m.NomMarca Mar
    -> FROM zz_JAO_tmpcrea6 a
    -> LEFT JOIN Marcas m ON a.Marca=m.Marca
    -> ORDER BY Clave;
+-------+------------------------------+
| Clave | Marca                        |
+-------+------------------------------+
|   145 | AZITROCIN                    |
|   147 | AUGMENTIN                    |
|   163 | ASAWIN                       |
|   165 | ASA 500                      |
|   182 | ANSAID                       |
----------------------------------------
| 21159 | VALDURE                      |
| 21168 | DYNASTAT                     |
| 21464 | TEMODAL                      |
+-------+------------------------------+
126 rows in set (0.15 sec)
[1 Apr 2004 6:00] MySQL Verification Team
I didn't pasted the complete query before, correcting:

mysql> SELECT DISTINCT m.Marca Clave, m.NomMarca Marca
    -> FROM zz_JAO_tmpcrea6 a
    -> LEFT JOIN Marcas m ON a.Marca=m.Marca
    -> ORDER BY Clave;
+-------+------------------------------+
| Clave | Marca                        |
+-------+------------------------------+
|   145 | AZITROCIN                    |
----------------------------------------
| 20889 | UROFLOX                      |
| 21073 | CIMOGAL                      |
| 21159 | VALDURE                      |
| 21168 | DYNASTAT                     |
| 21464 | TEMODAL                      |
+-------+------------------------------+
126 rows in set (0.22 sec)
[1 Apr 2004 6:21] Jose Ostos
I have found the bug to be in the interface library that I am using (zeos) and not the server. Thanks for your help and sorry for the inconvenience.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.040 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.