I am trying to create a query within Maximo for a storeroom attendant to query items in their storeroom that has had no issues for the past 7 years, has been in the storeroom for over 7 years and has no open PO's or PR's. We will use this query to determine whether to obsolete the inventory record from the storeroom. I have a couple queries that I have tried to modify and/or combine but I can't make any of them work together. I would appreciate any help.
This query gives me all items without an open PO
status = 'ACTIVE' and not exists (select 1 from poline pol where inventory.siteid = pol.tositeid and inventory.location = pol.storeloc and inventory.itemsetid = pol.itemsetid and inventory.itemnum = pol.itemnum and pol.receiptscomplete = 0 and pol.linetype = 'ITEM' and exists (select 1 from po where ponum=pol.ponum and revisionnum=pol.revisionnum and siteid=pol.siteid and status in ('APPR', 'CONF') and revisionnum = (select max(revisionnum) from po por where por.ponum=po.ponum and por.siteid = po.siteid) ) )
This query gives me all items with any transactions in the INVTRANS table that are dated within the last month but we need inventory with INSERTTYPE = INSERTITEM and INVTRANS.TRANSDATE > 7 YEARS
siteid = (select defsite from maxuser where userid = :&USERNAME& ) and (exists (select 1 from dbo.invtrans where (datepart(m, transdate) = datepart(m, dateadd(m, -1, getdate())) and datepart(yy, transdate) = datepart(yy, dateadd(m, -1, getdate()))) and (itemnum = inventory.itemnum and storeloc = inventory.location and siteid=inventory.siteid)))
And I want to combine these 2 queries into one. Can anyone help me with this?
#Inventory------------------------------
Teresa Allen
GAF
------------------------------