select *
from WorkItem W,ProcessInstance P ,
(SELECT MAX(P1.createdTime ) AS m FROM WorkItem W1 ,ProcessInstance P1
Where P1.contextOID= W1.contextOID
And P1.processDefinitionId='PerformanceAssessment_003'
And W1.workItemName='¦Ûµû¶ñ¼g'
And W1.performerOID in ('c7324cb4cd6a1004885f3408ccd4a6ff','ea0d8b04cd7e1004889adc3e5719cbd7','d9e70f44cd7d1004837699664bd98c42')
GROUP BY W1.performerOID) AS B
where
P.contextOID=W.contextOID
And P.processDefinitionId='PerformanceAssessment_003'
And workItemName='¦Ûµû¶ñ¼g'
And performerOID in ('c7324cb4cd6a1004885f3408ccd4a6ff','ea0d8b04cd7e1004889adc3e5719cbd7','d9e70f44cd7d1004837699664bd98c42')
And P.createdTime =B.m
And P.currentState in ('3','1')
select Us.OID,uid,ddate,depId,umasterId,cdepId
from
Users Us,
PerformanceAssessment_007_Grid0 G0,
(SELECT MAX(formSerialNumber) AS m FROM PerformanceAssessment_007_Grid0 PG0
Where PG0.depId ='J010'
And PG0.ddate='2011-¤W¥b¦~'
And PG0.umasterId='MH0433') AS B
where
G0.formSerialNumber = B.m
And G0.depId= 'J010'
And ddate='2011-¤W¥b¦~'
And umasterId='MH0433'
AND Us.id = uid