I am trying to write a query to retrieve the max dispatched date and also bringing in fields from multiple tables. Im using the fields from other tables since the table that contains the dispatched date does not contain any of the information that I am looking for. (hope that makes sense) This is the code that I am currently using and it is not working:
Here is what I was getting before I started playing with the code:
This is what I am trying to retrieve:
select a.order_num,
LAB_USER.NAME as ASGN_TECH,
(select max(asn_assignment.dispatched)
from asn_assignment
where a.for_order=asn_assignment.for_order) as "max date"
from asn_assignment, ord_order_state a, lab_user, lab_resource, asn_assignment
where
LAB_USER.USER_ID = LAB_RESOURCE.FOR_USER
AND LAB_RESOURCE.RESOURCE_ID = ASN_ASSIGNMENT.FOR_RESOURCE
and order_num in ('800000194709',
'800000213722',
'800006513931',
'800006525705')