MySql, I love it...

I'm building an asset management system..
I've got an asset table, with basse info, and a version table, where
each susperceeded version of an asset sits.

When I do a call to get a list of assets, and the latest version
number, I'm having probs..

I can get the last version number, by using MAX(), but how can I tell
the query to get the corresponding fields from the SAME row..

I'm currently getting the file name from version one, even though in
my DB, I've many versions..

Here's my query..

SELECT asset.id, MAX(assetVersion.id) as assetVersionId,
asset.naturalName, assetVersion.fileName,
MAX(assetVersion.versionNumber) as versionNumber, assetVersion.status
        FROM asset, assetVersion
        WHERE
        assetVersion.assetId = asset.id
        group BY id ASC

Here's the output..
id,  assetVersionId,  naturalName,  fileName,  versionNumber,  status
1,  5,  Tristans Test Jpg,  tris.jpg,  3,  1
2,  4,  Santas delivery plan, route.xls,  2,  1


Am i being a tool???

____ � 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: archive@jab.org
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.

Reply via email to