Receives the seizure of goods delivered

select count(1)
from (select l.isrepeat
from lims_folders t
join base_corp p
on t.submitcorp = p.corpcode
join lims_clearanceform l
on t.clearanceid = l.clearanceid
join lims_testrequesttypes lt
on lt.testrequesttypesid = l.reqsubtypid
and lt.datalevel = '3'
left join lims_sample_programs lsp
on lsp.sampleprogramsid = t.sampleprogramsid
left join lims_domainreport ld
on ld.reqsubtypeid = l.reqsubtypid
and ld.dept = l.dept
left join lims_prodgroup lp
on lp.prodgroupid = l.inspectionitem
/* left join (select max(limit.enddate) enddate,
limit.foldersid,
max(limit.timelimits) timelimits
from (SELECT max (t9.enddate) EndDate,
t9.foldersid,
SUM (timelimit) Timelimits
from lims_folderstimelimit T9
Group by t9.foldersid, t9.dept) limit
Group by limit.foldersid) T8
ON t.foldersid * = t8.foldersid /
the WHERE ld.dept = 'NJIFDC' - futile
and l.type = (case --type health food, cosmetics, pharmaceuticals, food, edible agricultural products
the when (the SELECT COUNT (1)
from (the SELECT wm_concat (r.datacode ) AS STP
from R & lt right_rightuser
WHERE r.usercode = 'hesu') T --hesu all the code sections
where instr (stp, 'YWKYP' )> 0)> 0 then - instr used instead like instr (title, ' oracle ')> 0 is equivalent to like instr (title,' oracle ' ) = 0 is equivalent to like not
- Drug operations Section YWKYP
' drugs'
the else
'food'
end)
and (exists
(SELECT. 1
from lims_ordtask OT
WHERE ot.foldersid = t.foldersid
and Upper (ot.wfnodecode) = 'JPSD') or Not EXISTS - converted to uppercase or presence JPSD lo list is no data service test article
( . 1 SELECT
from lims_ordtask OT
WHERE ot.foldersid = t.foldersid))
and t.dept = 'NJIFDC' - this is futile
and t.category = 'Food'
and (NVL (t.status, '111' ) = '111')) - are empty

Guess you like

Origin www.cnblogs.com/jingcx/p/12567313.html