I need to write a query that will return the Work Order,first step, and step description from the following table where its Copletion date IS NULL.
WorkOrder Step Description CompletionDate
WO001 1 Mat. Injection 5/1/04
WOO01 2 Deburring 5/2/04
WO001 3 Inspection NULL
WO001 4 Shipping NULL
WO002 1 Grinding 5/2/04
WO002 2 Inspection NULL
WO002 3 Shipping NULL
WO003 1 Mat. Melting NULL
WO003 2 Inspection NULL
WO003 3 Shipping NULL
The query should produce the following result:
WO001,3,Inspection
WO002,2,Inspection
WO003,1,Mat. Melting
I tried the following syntax but it did not work for me:
SELECT WorkOrder, MIN(Step) AS step, Description
FROM tblWorkOrderDtl
WHERE (CompletionDate IS NULL)
GROUP BY WorkOrderNo
Could someone please help me with the syntax.
Thanks in advance
RR![[2thumbsup] [2thumbsup] [2thumbsup]](/data/assets/smilies/2thumbsup.gif)
WorkOrder Step Description CompletionDate
WO001 1 Mat. Injection 5/1/04
WOO01 2 Deburring 5/2/04
WO001 3 Inspection NULL
WO001 4 Shipping NULL
WO002 1 Grinding 5/2/04
WO002 2 Inspection NULL
WO002 3 Shipping NULL
WO003 1 Mat. Melting NULL
WO003 2 Inspection NULL
WO003 3 Shipping NULL
The query should produce the following result:
WO001,3,Inspection
WO002,2,Inspection
WO003,1,Mat. Melting
I tried the following syntax but it did not work for me:
SELECT WorkOrder, MIN(Step) AS step, Description
FROM tblWorkOrderDtl
WHERE (CompletionDate IS NULL)
GROUP BY WorkOrderNo
Could someone please help me with the syntax.
Thanks in advance
RR
![[2thumbsup] [2thumbsup] [2thumbsup]](/data/assets/smilies/2thumbsup.gif)