[thelist] SQL trouble

Dan Parry dan at shaded.plus.com
Wed Nov 16 15:14:04 CST 2011


Hi all

I am very out of practice with anything more than simple SQL just at the minute and I can't for the life of me figure out how to do what I need. Let's assume for simplicity I have the following tables:

Batches:

id
uniq
created

Status history:

id
batch_id
status
created

When the status of a batch is changed it creates a new record in the status history table allowing a historical record. The problem I'm having is actually retrieving records based on the current (latest) status history record

Let's say that the statuses are numeral 1-4, how would I go about finding batches with only the status of, say, 3

Any advice or pointers would be greatly appreciated

Cheers!

Dan


More information about the thelist mailing list