Jim Underwood
3/15/2007 3:06:00 PM
You could use a subquery to filter the date and only select rows where the
date is equal to the max date for your keys (or group by columns).
Something like this...
select WF.WorkflowNo
, WF.JobNo
, WF.step
, WF.Status
, WF.WFDateTime
from WorkFlowHistory as WF
where WF.WFDateTime =
(
select max(WF1.WFDateTime)
from WorkFlowHistory as WF1
where WF.JobNo = WF1.JobNo
and WF.step = WF1.step
and WF.WorkflowNo = WF1.WorkflowNo
)
"jobs" <jobs@webdos.com> wrote in message
news:1173969975.180505.201920@e65g2000hsc.googlegroups.com...
> select WorkflowNo, JobNo, step, max(WFDateTime) from WorkFlowHistory
> group by WorkFlowNo, JobNo, Step
>
> produces this:
>
>
> workflowno jobno step WFDateTime
> 34 512 1 2007-03-14 09:45:01.520
> 34 513 2 2007-03-14 09:54:01.300
> 34 514 3 2007-03-14 09:55:01.453
> 35 534 1 2007-03-14 15:07:01.197
> 35 535 2 2007-03-14 15:14:01.250
> 35 536 3 2007-03-14 15:15:01.330
>
> That same table has column Status. How could I have reported the
> associated Status for that Date?
>
> Thanks for any help or information.
>