Subject | Help with a query |
---|---|
Author | willfordkc |
Post date | 2004-07-23T20:02:11Z |
Is there a better way to write the following query?
I want to get the cost and quantity for a product
with the max date and time for that product.
select cost, quantity, date, time
from table
where date =
( select max(date)
from table
where product = '406423004265' AND quantity > 0 )
AND time =
( select max(time)
from table
where product = '406423004265' AND quantity > 0 )
I want to get the cost and quantity for a product
with the max date and time for that product.
select cost, quantity, date, time
from table
where date =
( select max(date)
from table
where product = '406423004265' AND quantity > 0 )
AND time =
( select max(time)
from table
where product = '406423004265' AND quantity > 0 )