List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:August 10 1999 1:24pm
Subject:Re: Actually: BUG with DISTINCT and ORDER on dates
View as plain text  
On Di, 1999-08-10 10:44:46 +0200, tony@stripped wrote:
> Further to my last message, I have discovered it's the ORDER BY that seems
> to cause the problem:
> 
> select distinct date_format(when, "ymd") from testsale order by when;
> +--------------------------+
> | date_format(when, "ymd") |
> +--------------------------+
> | 990808                   |
> | 990808                   |
> | 990809                   |
> | 990809                   |
> | 990809                   |
> | 990810                   |
> | 990810                   |
> | 990810                   |
> +--------------------------+

Upgrading to V3.23.3 may solve this problem, but you also can avoid it
by naming the calculated column and sort by it:

  SELECT DISTINCT DATE_FORMAT(when, "ymd") AS mywhen
  FROM testsale
  ORDER BY mywhen;

I hope that works for you, too.

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
Actually: BUG with DISTINCT and ORDER on datestony10 Aug
  • Re: Actually: BUG with DISTINCT and ORDER on datesMartin Ramsch10 Aug
    • Re: Actually: BUG with DISTINCT and ORDER on datesMichael Widenius17 Aug