Ysgrifennodd Tim McIntyre:
Next pint is on me Peter;-) The following turned out to be exactly
what I needed:
SELECT s1.id
FROM status_histories s1
WHERE s1.type = 'StatusHistoryOrder'
AND s1.code = 1
AND s1.created_at = (SELECT MAX(s2.created_at)
FROM statu
Next pint is on me Peter;-) The following turned out to be exactly
what I needed:
SELECT s1.id
FROM status_histories s1
WHERE s1.type = 'StatusHistoryOrder'
AND s1.code = 1
AND s1.created_at = (SELECT MAX(s2.created_at)
FROM status_histories s2
Ysgrifennodd Tim McIntyre:
I tried that Peter and for some reason it's still selecting the oldest
date not the newest??? Seems odd? Also I'd really like to just select
id because I'll be using this in a subselect.
Thanks!
Tim
SELECT s1.order_id
FROM status_histories s1
WHERE s1.type = 'Statu
I tried that Peter and for some reason it's still selecting the
oldest date not the newest??? Seems odd? Also I'd really like to
just select id because I'll be using this in a subselect.
Thanks!
Tim
On Dec 8, 2006, at 10:31 AM, Peter Bradley wrote:
Ysgrifennodd Tim McIntyre:
Thanks for th
Ysgrifennodd Tim McIntyre:
Thanks for the responses guys however I was running out the door
yesterday and I oversimplified my problem. Sorry about that, let me
try again.
Here is my "status_histories" table with some data:
id order_id code
type
Thanks for the responses guys however I was running out the door
yesterday and I oversimplified my problem. Sorry about that, let me
try again.
Here is my "status_histories" table with some data:
id order_id code type
created_at
79 1