Re: Selecting records based on max and value

2007-01-12 Thread Shawn Green
Hi David, David Ruggles wrote: Supplyorder uid double (auto) (pk) sitedouble datedate Supplyorderhistory uid double (auto) (pk) supplyorderuid double status double Supplyorderlineitems uid double (auto) (pk)

RE: Selecting records based on max and value

2007-01-12 Thread David Ruggles
es Cc: 'mysql' Subject: Re: Selecting records based on max and value David, >I want to select for a given date all sites that have >the last history record with a certain status. Try something like ... SELECT h1.supplyorderid FROM supplyorder o JOIN supplyorderhistory h1 ON o.

Re: Selecting records based on max and value

2007-01-12 Thread Peter Brawley
David, I want to select for a given date all sites that have the last history record with a certain status. Try something like ... SELECT h1.supplyorderid FROM supplyorder o JOIN supplyorderhistory h1 ON o.uid=h1.supplyorderuid LEFT JOIN supplyorderhistory h2 ON h2.supplyorderuid = h.supply

Selecting records based on max and value

2007-01-12 Thread David Ruggles
I'm new to this list, but have searched through the archives and haven't found anything that addresses my question. First a little background: I'm creating a supply ordering system. Each supply order may be modified many times before being approved and finally filled. I created the following dat