J
James
Im trying to figure how how to return order status info. i.e. OrderID,
CurrentStatus, CompletedDate, DeliveredDate. i have an order table and a
statuslog table. the status log table is like this. OrderID, Status,Date. it
can log a history of differnt status's i.e. Order Received, Completed,
Delivered, etc. How can i return one record that shows the OrderID,
CurrentStatus, CompletedDate, DeliveredDate. obvoulsy if the order doesn't
have a completed or delivered entry it can't show the date, but i still need
it to show the record and the current status. below is a sql i have that
works to show the current status. but how can i get it to show the
CompletedDate and/or the DeliveredDate? would a nested select in a join help
me? i don't know how to do those.
SELECT sl.OrderID, sl.Status
FROM Statuslog AS sl
WHERE (((sl.Date)=(SELECT Max(sl2.date)
FROM statuslog As sl2
WHERE sl2.orderid = sl.orderid)));
CurrentStatus, CompletedDate, DeliveredDate. i have an order table and a
statuslog table. the status log table is like this. OrderID, Status,Date. it
can log a history of differnt status's i.e. Order Received, Completed,
Delivered, etc. How can i return one record that shows the OrderID,
CurrentStatus, CompletedDate, DeliveredDate. obvoulsy if the order doesn't
have a completed or delivered entry it can't show the date, but i still need
it to show the record and the current status. below is a sql i have that
works to show the current status. but how can i get it to show the
CompletedDate and/or the DeliveredDate? would a nested select in a join help
me? i don't know how to do those.
SELECT sl.OrderID, sl.Status
FROM Statuslog AS sl
WHERE (((sl.Date)=(SELECT Max(sl2.date)
FROM statuslog As sl2
WHERE sl2.orderid = sl.orderid)));