[thelist] SQL trouble

Dan Parry dan at shaded.plus.com
Thu Nov 17 07:38:06 CST 2011


Thanks! That works perfectly! I'm still testing and messing about with this but you have helped me out a great deal



-----Original Message-----
From: thelist-bounces at lists.evolt.org [mailto:thelist-bounces at lists.evolt.org] On Behalf Of Anthony Baratta
Sent: 17 November 2011 00:50
To: thelist at lists.evolt.org
Subject: Re: [thelist] SQL trouble

I'm concerned that the SQL is not working correctly, if the "catch-all" 
is not returning the latest status for each batch.

I have a better idea:

select batches.id, batches.uniq, history.status from batches join (select max(id) as history_id, batch_id from history group by
batch_id) as history_max
     on batches.id = history_max.batch_id join history on history.id = history_max.history_id

Anthony Baratta

Forgiveness does not change the past, but it does enlarge the future
-- Paul Bose


* * Please support the community that supports you.  * * http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester and archives of thelist go to: http://lists.evolt.org Workers of the Web, evolt ! 

More information about the thelist mailing list