Hey - -- -- -

My brain is hurting over this one. This is running on a MySQL engine 
through SPT.

Issue: In a class training application, I am trying to get the next 
logical sequence of classes by part.

Problem: The PK value of the table is determining the records that are 
selected in the GROUP BY rather than the stated ORDER BY.

Data Situation (simplified):

PK_VAL    Part   ClassWhen    
200          1        2009-12-01 08:00:00
201          2        2009-12-01 13:00:00
100          1        2009-12-07 08:00:00
101          2        2009-12-07 13:00:00
102          3        2009-12-08 08:00:00
103          4        2009-12-08 13:00:00

With the SQL:
SELECT pk_val,part,ClassWhen
  from my_sched
  where ClassWhen >= 2009-12-01 00:00:00
    group by part
   order by part,ClassWhen

(a single "group by" is allowed by MySQL, just like "set enginebehavior 
70")

I get:
100          1        2009-12-07 08:00:00
101          2        2009-12-07 13:00:00
102          3        2009-12-08 08:00:00
103          4        2009-12-08 13:00:00

Somehow the PK_VAL is "winning" in the group by, rather than the 
explicitly-stated order.

I want to get:
200          1        2009-12-01 08:00:00
201          2        2009-12-01 13:00:00
102          3        2009-12-08 08:00:00
103          4        2009-12-08 13:00:00

Ideas? What am I missing with this? (Will the magic "Send" button lift 
the veil from my eyes?)

Thanks,

Ken


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to