Cool..
I've in my head that group by is the same as distinct in the select
part of the query..

When I only want results of one type...
Is that right?



On 23/11/06, r937 <[EMAIL PROTECTED]> wrote:
> Am i being a tool???

yes, for you have failed to grasp how GROUP BY works    ;o)

the reason you are getting incorrect results is because there are some
columns in your SELECT list which aren't in the GROUP BY

this is the so-called "GROUP BY with hidden fields" scenario

see http://dev.mysql.com/doc/refman/5.0/en/group-by-hidden-fields.html


in any case, you do not want to be using GROUP BY here at all

     select asset.id
          , assetVersion.id as assetVersionId
          , asset.naturalName
          , assetVersion.fileName
          , assetVersion.versionNumber as versionNumber
          , assetVersion.status
       from asset
     inner
       join assetVersion
         on assetVersion.assetId = asset.id
        and assetVersion.versionNumber =
            ( select max(versionNumber)
                from assetVersion
               where assetId = asset.id )


____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
      Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.


____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
      Send Your Posts To: wdvltalk@lists.wdvl.com
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk

________________  http://www.wdvl.com  _______________________

You are currently subscribed to $subst('List.Name') as: 
$subst('Recip.EmailAddr')
To unsubscribe send a blank email to $subst('Email.UnSub')
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Reply via email to