plainblack.com
Username Password
search
Bookmark and Share

    

When is a wobject a wobject?

User philadev
Date 3/25/2008 2:23 pm
Views 1072
Rating -5    Rate [
|
]
Previous · Next
User Message
philadev

That's a misleading question, kinda.

I'm testing a script against the database and I noticed that my newly added asset (Folder) has no 'description' in the wobject table.  Despite that I added a full description about ten minutes ago.

When is the data that is there end up there? 

I'm running:

SELECT assetData.url, wobject.description, wobject.assetId FROM assetData LEFT JOIN wobject ON assetData.assetId = wobject.assetId WHERE assetData.assetId='XXXX' GROUP BY url 

Anyone have a lead on this? 

--- (Edited on 3/25/2008 2:23 pm [GMT-0500] by philadev) ---



Back to Top
Rate [
|
]
 
 
preaction

You're not taking revisionDate into account. You need to grab the latest revisionDate, not just any random one. 

--- (Edited on 3/25/2008 2:43 pm [GMT-0500] by preaction) ---



Back to Top
Rate [
|
]
 
 
philadev

You are 100% right and in my original sequel I have it testing for the max revisionDate. Still, without max(whatever) i should get all of the rows related to assetId, right?

Unfortunately I'm getting one row and it has no description value. Contrary to the asset's appearance.

 

--- (Edited on 3/25/2008 3:19 pm [GMT-0500] by philadev) ---



Back to Top
Rate [
|
]
 
 
preaction
You have a GROUP BY clause. This causes all the rows to be collapsed based on whatever column you specify (in your case, url).

--- (Edited on 3/25/2008 3:33 pm [GMT-0500] by preaction) ---



Back to Top
Rate [
|
]
 
 
philadev

Correct again. I had to rework the sequel entirely. Thanks for your help.

 

This is what ended up with:

SELECT ad.url, wo.description, ad.assetId, ad.revisionDate 

FROM assetData ad, wobject wo

WHERE ad.assetId='XXX'

AND ad.assetId = wo.assetId 

AND ad.revisionDate = wo.revisionDate 

AND ad.revisionDate=(Select max(revisionDate) 

FROM assetData 

WHERE assetId = ad.assetId) 

 

 

--- (Edited on 3/26/2008 8:17 am [GMT-0500] by philadev) ---



Back to Top
Rate [
|
]
 
 
    



© 2012 Plain Black Corporation | All Rights Reserved