>Hi all,
>
>I was wondering what's wrong with a query like this:
>
>select itemlist.... , sum(field1), count(*) as cnt from table where 
>where conditions group by id having cnt=2 order by field_x, field_y 
>desc limit 10
>
>I am expecting to get the requested rows order by field_x. Those 
>with same value ( as in field_x=5 ) should be additionaly ordered by 
>field_y. So for example I 'd get:
>
>field_x, field_y
>5        2
>5        2
>5        1
>5        0
>4        5
>3        8
>
>and so on.
>
>Am I missing the point of order by here? If so, what is the best 
>way/fastest way to achieve the required results set?

It's not clear what you are trying to do, sir. My guess is that you 
are expecting more than one row for each id, which you won't get with 
'GROUP BY id'.

If you need more help, give us a better idea of the result table you want.

Bob Hall

Know thyself? Absurd direction!
Bubbles bear no introspection.     -Khushhal Khan Khatak

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to