It was my understanding that it should actually work that way, but SQL does not 
guarantee that with GROUP BY clauses -- you would want to use an ORDER BY clause if 
you want to guarantee order.  The problem could be in one of your char fields  -- 
maybe an extra space somewhere that's messing up the ordering?
 
Steve Meyers


> -----Original Message-----
> From: Sommai Fongnamthip [mailto:[EMAIL PROTECTED]]
> Sent: Friday, October 19, 2001 3:19 AM
> To: [EMAIL PROTECTED]
> Subject: group by clause
> 
> 
> Hi,
>       did someone tell me why group by clause not work?  I'd like 
> to group 
> volume of order from my customer at the same price and my supplier.  here 
> is my code
> 
>       Select custid, symbol, sum(volume) as sumvol, price, mktid, 
> supplier, 
> supplierflag
>       From confirm
>       WHERE mktid=123 or mktid=456
>       Group by custid, symbol, supplier, supplierflag, price
>       I got this:
>       
>       row#    custid       symbol    sumvol   price   mktid  
> supplier  supplierflag
>                 (char)       (char)    (int)    (double) 
> (char)  (char)    (char)
>       1       1234         XXX          100      12     123      
> 1        C
>       2       1234         XXX          150      12     123      
> 2        C
>       3       1234         XXX          200      13     123      
> 1        E
>         Why row 3 not follow data in row 1 instead of row 2?  How could I 
> correct my SQL statement?
> 
> SF 
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 



---------------------------------------------------------------------
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