Bug #18799 Query executes fine in consol, but gets weird error in QB
Submitted: 5 Apr 2006 13:03 Modified: 15 Nov 2006 14:16
Reporter: Tobias Asplund Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Query Browser Severity:S3 (Non-critical)
Version:1.1.20 OS:Windows (Windows)
Assigned to: Mike Lischke CPU Architecture:Any
Tags: Source Editors

[5 Apr 2006 13:03] Tobias Asplund
Description:
This query doesn't work when executed from the query browser.

SELECT Continent, Population, Name
  FROM Country AS C
    JOIN
   (SELECT Continent AS Cont, MAX(Population) AS Pop, Code
     FROM Country
     GROUP BY Continent) AS M
     ON C.Continent = M.Cont AND Population = Pop AND C.Code = M.Code

Gets an "Column 'Code' in field list is ambigous" whereas it works fine in any other client.

My guess is that QB tries to be smart and adds Code somewhere since it's the primary key of the Country table.

(test case using the world example db at the docs pages).

How to repeat:
SELECT Continent, Population, Name
  FROM Country AS C
    JOIN
   (SELECT Continent AS Cont, MAX(Population) AS Pop, Code
     FROM Country
     GROUP BY Continent) AS M
     ON C.Continent = M.Cont AND Population = Pop AND C.Code = M.Code
[5 Apr 2006 14:39] MySQL Verification Team
Thank you for the bug report.
[15 Nov 2006 14:16] Mike Lischke
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html