If you still cannot figure out what is wrong, create a
minimal test that can be run with mysql test <
query.sql that shows your problems. You can
create a test file by dumping the tables with
mysqldump --quick db_name
tbl_name_1 ...
tbl_name_n >
query.sql. Open the file in an editor, remove
some insert lines (if there are more than needed to
demonstrate the problem), and add your
SELECT statement at the end
of the file.

Verify that the test file demonstrates the problem by
executing these commands: