Sql rry;我不明白你在说什么。哦,我的意思是我用左连接来连接我所有的表,包括这个。 select a5.LOTID,COUNT(a5.stephandle) AS STEPHANDLE from LOTFLOW_D a5, (select

Sql rry;我不明白你在说什么。哦,我的意思是我用左连接来连接我所有的表,包括这个。 select a5.LOTID,COUNT(a5.stephandle) AS STEPHANDLE from LOTFLOW_D a5, (select ,sql,oracle,oracle-sqldeveloper,Sql,Oracle,Oracle Sqldeveloper,rry;我不明白你在说什么。哦,我的意思是我用左连接来连接我所有的表,包括这个。 select a5.LOTID,COUNT(a5.stephandle) AS STEPHANDLE from LOTFLOW_D a5, (select distinct(LOTID),MAX(STEPHANDLE) AS STEPHANDLE from Lotmove_R where QTAP_GROUP In ('8685','8686','8687','8688','8689','


rry;我不明白你在说什么。哦,我的意思是我用左连接来连接我所有的表,包括这个。
    select a5.LOTID,COUNT(a5.stephandle) AS STEPHANDLE from LOTFLOW_D a5,

    (select distinct(LOTID),MAX(STEPHANDLE) AS STEPHANDLE from Lotmove_R
    where QTAP_GROUP In ('8685','8686','8687','8688','8689','8533','8532','2534','2533','8684','8690')
    and datadate>sysdate-3
    and priority<=5
    and SUBPLANID NOT LIKE '%RWK%' AND STEPHANDLE NOT LIKE '%8888%' AND STEPHANDLE LIKE '%.%.%'
    group by lotid) a6

    where a5.lotid=a6.lotid 
    and a5.STEPHANDLE > a6.STEPHANDLE AND A5.EQPTYPE NOT IN ('CUDDFINP','CUBDFINP','BDFINP','DDFINP','CUDFSEM','DFSEM','SORT','CUSORT','CUNPURGE','NPURGE','EDFINP','CUEDFINP')

    group by a5.lotid
    order by a5.lotid 
LOTID    STEPHANDLE
_____    ___________
S8CN9      214
S7JY7      30
 ...      .....
Select a5.lotid,a5.STEPHANDLE from 

(select lotid,COUNT(stephandle) as STEPHANDLE, EQPTYPE from LOTFLOW_D Group by lotid, EQPTYPE ) a5

left join

(select distinct(LOTID), MAX(STEPHANDLE) AS STEPHANDLE from Lotmove_R
where QTAP_GROUP In ('8685','8686','8687','8688','8689','8533','8532','2534','2533','8684','8690')
and datadate>sysdate-3
and priority<=5
and SUBPLANID NOT LIKE '%RWK%' AND STEPHANDLE NOT LIKE '%8888%' AND STEPHANDLE LIKE '%.%.%'
group by lotid) a6 on a5.lotid=a6.lotid

where a5.STEPHANDLE > a6.stephandle AND a5.EQPTYPE NOT IN ('CUDDFINP','CUBDFINP','BDFINP','DDFINP','CUDFSEM','DFSEM','SORT','CUSORT','CUNPURGE','NPURGE','EDFINP','CUEDFINP')

order by a5.lotid 
          ON a5.lotid = a6.lotid
WHERE     a5.STEPHANDLE > a6.stephandle
ON (a5.lotid = a6.lotid AND a5.STEPHANDLE > a6.stephandle)
SELECT a5.lotid, a5.STEPHANDLE
FROM (  SELECT lotid, TO_CHAR (COUNT (stephandle)) AS STEPHANDLE, EQPTYPE
          FROM LOTFLOW_D
      GROUP BY lotid, EQPTYPE) a5
     LEFT JOIN (  SELECT DISTINCT (LOTID), MAX (STEPHANDLE) AS STEPHANDLE
                    FROM Lotmove_R
                   WHERE     QTAP_GROUP IN ('8685',
                                            '8686',
                                            '8687',
                                            '8688',
                                            '8689',
                                            '8533',
                                            '8532',
                                            '2534',
                                            '2533',
                                            '8684',
                                            '8690')
                         AND datadate > SYSDATE - 3
                         AND priority <= 5
                         AND SUBPLANID NOT LIKE '%RWK%'
                         AND STEPHANDLE NOT LIKE '%8888%'
                         AND STEPHANDLE LIKE '%.%.%'
                GROUP BY lotid) a6
         ON (a5.lotid = a6.lotid AND a5.STEPHANDLE > a6.stephandle)
WHERE a5.EQPTYPE NOT IN ('CUDDFINP',
                         'CUBDFINP',
                         'BDFINP',
                         'DDFINP',
                         'CUDFSEM',
                         'DFSEM',
                         'SORT',
                         'CUSORT',
                         'CUNPURGE',
                         'NPURGE',
                         'EDFINP',
                         'CUEDFINP')
ORDER BY a5.lotid
a5.STEPHANDLE > a6.STEPHANDLE
'1.2.3' < '2.3.4' '1.2.3' > '10.0.0' '1.2.3' > '1.2.04' '1.2.3' > '1.2.20'
a5.STEPHANDLE > a6.stephandle
a5.STEPHANDLE_COUNT > a6.stephandle
select lotid, count(*) as stephandles
from lotflow_d d
where eqptype not in ('CUDDFINP','CUBDFINP','BDFINP','DDFINP','CUDFSEM', 'DFSEM',
                      'SORT','CUSORT','CUNPURGE','NPURGE','EDFINP','CUEDFINP')
and not exists
(
  select *
  from lotmove_r r
  where r.lotid = d.lotid
    and r.stephandle >= d.stephandle
    and r.stephandle not like '%8888%'
    and r.stephandle like '%.%.%'
    and r.qtap_group in ('8685','8686','8687','8688','8689','8533',
                         '8532','2534','2533','8684','8690')
    and r.datadate > sysdate-3
    and r.priority <= 5
    and r.subplanid not like '%RWK%'
)
group by lotid
order by lotid;