Bug? Distinct AS with Order By

Bug? Distinct AS with Order By

am 22.10.2009 17:28:04 von Matt Neimeyer

I'm not sure what to search on to see if someone has reported this as
a bug or if I'm doing something wrong...

Generic code to draw a SELECT element on the screen sometimes it ends
up like such...

SELECT DISTINCT name AS myvalue,name AS mydisp FROM names WHERE
name!="" ORDER BY myvalue

On 4.1.22 this returns

A A
B B
C C
D D

On 5.0.22 this returns

D D
D D
D D
D D

The odd thing is that if I remove the order by clause it works fine...
It also works fine if I remove the second copy of the column BUT this
is generic code so it might also be doing something like "productid as
myvalue,productname as mydisp" where the values are different.

Ultimately I can sort the array I end up with but it seems like this
should work. Especially since it did in 4.x.

Am I crazy? Doing something wrong?

Thanks!

Matt

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Re: Bug? Distinct AS with Order By

am 22.10.2009 18:30:31 von Glyn Astill

> From: Matt Neimeyer =0A>=0A> Generic code to draw a SE=
LECT element on the screen=0A> sometimes it ends=0A> up like such...=0A> =
=0A> SELECT DISTINCT name AS myvalue,name AS mydisp FROM names=0A> WHERE=0A=
> name!=3D"" ORDER BY myvalue=0A> =0A> On 4.1.22 this returns=0A> =0A> A A=
=0A> B B=0A> C C=0A> D D=0A> =0A> On 5.0.22 this returns=0A> =0A> D D=0A> D=
D=0A> D D=0A> D D=0A> =0A> The odd thing is that if I remove the order by =
clause it=0A> works fine...=0A> It also works fine if I remove the second c=
opy of the=0A> column BUT this=0A> is generic code so it might also be doin=
g something like=0A> "productid as=0A> myvalue,productname as mydisp" where=
the values are=0A> different.=0A> =0A> Ultimately I can sort the array I e=
nd up with but it seems=0A> like this=0A> should work. Especially since it =
did in 4.x.=0A> =0A> Am I crazy? Doing something wrong?=0A> =0A> Does=
n't look crazy to me, and it works in 5.0.32 http://www.privatepaste.c=
om/50RvhihKKm Perhaps time to patch that server ... Send instant =
messages to your online friends http://uk.messenger.yahoo.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg

Re: Bug? Distinct AS with Order By

am 22.10.2009 18:36:37 von Glyn Astill

> From: Glyn Astill =0A> =0A> Doesn't look crazy to=
me, and it works in 5.0.32=0A> =0A> http://www.privatepaste.com/50RvhihKKm=
=0A> =0A> Perhaps time to patch that server ...=0A> I've guessed at t=
he table def there, obviously your def may be different and that would sure=
ly affect the palanners choice. Perhaps you'd post yours? Send instant=
messages to your online friends http://uk.messenger.yahoo.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg