Bug #13841 Problem with DISTINCT key word
Submitted: 7 Oct 2005 13:49 Modified: 7 Nov 2005 14:44
Reporter: chowdary kora Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version: 5.0.6-beta OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any

[7 Oct 2005 13:49] chowdary kora
Description:
Hi i got a problem with mysql query,
i have a table Monthly_Transactions_Locations with structure :
CREATE TABLE gskitdc.monthly_transactions_locations (
    `Session_Id` INT ( 11 ) NOT NULL DEFAULT '0',
    `Month` INT ( 11 ) NOT NULL DEFAULT '0',
    `Year` INT ( 11 ) NOT NULL DEFAULT '0',
    `Availability_Transactions` text,
    `Availability_Locations` text,
    `Performance_Transactions` text,
    `Performance_Locations` text,
    PRIMARY KEY ( `Session_Id`,
		  `Month`,
		  `Year` )
) ENGINE = MyISAM DEFAULT CHARSET = latin1;

here is my problem with DISTINCT key word : please find the differenece between two queries,why it is not working with second query???
C:\>mysql -u root -h localhost
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 248 to server version: 5.0.6-beta

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

mysql> use gskitdc
Database changed
mysql> SELECT SESSION_ID FROM Monthly_Transactions_Locations WHERE Month=11 AND
Year=2005;
+------------+
| SESSION_ID |
+------------+
|          1 |
|          2 |
|          3 |
|          4 |
|          5 |
|          6 |
+------------+
6 rows in set (0.00 sec)

mysql> SELECT DISTINCT SESSION_ID FROM Monthly_Transactions_Locations WHERE Mont
h=11 AND Year=2005;
Empty set (0.00 sec)

mysql>

How to repeat:
C:\>mysql -u root -h localhost
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 248 to server version: 5.0.6-beta

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

mysql> use gskitdc
Database changed
mysql> SELECT SESSION_ID FROM Monthly_Transactions_Locations WHERE Month=11 AND
Year=2005;
+------------+
| SESSION_ID |
+------------+
|          1 |
|          2 |
|          3 |
|          4 |
|          5 |
|          6 |
+------------+
6 rows in set (0.00 sec)

mysql> SELECT DISTINCT SESSION_ID FROM Monthly_Transactions_Locations WHERE Mont
h=11 AND Year=2005;
Empty set (0.00 sec)

mysql>
[7 Oct 2005 13:55] chowdary kora
Bug_Screen Shot

Attachment: MYSQLBUG.doc (application/octet-stream, text), 165.00 KiB.

[7 Oct 2005 14:44] Hartmut Holzgraefe
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

You are running a rather old beta version, can you please verify whether the problem
still exists in the latest release candidate (5.1.13) please?
[8 Nov 2005 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".