Major SQL

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

Hello Shereen -

For each plan there are set of dyd and matrix cables created in the database for
different granularity.

For eg.
For supply plan 'Spareparts - T1'

Run the below query to fetch the plan id

SELECT /*3-29641236811*/
*
FROM
fusion.msc_plan_definitions
WHERE compile_designator = 'Spareparts - T1'

Note the plan_id. In this case it is - 300000360997847

Run the below query to find the tables associated with the plan

select /*3-29641236811*/
*
from FUSION.MSC_PLAN_TABLES mpt
where mpt.PLAN_ID=300000360997847

To get the details of onhand, PAB etc which is seen in material plan run the below
query to find the table

####
select /*3-29641236811*/
PDS_TABLE_NAME
from FUSION.MSC_PLAN_TABLES mpt
where 1 = 1
and mpt.PLAN_ID=300000360997847
and ENTITY_ID = 125

In your case the PDS_TABLE_NAME is MSC_DATA_9002_DYD.

select * from fusion.MSC_DATA_9002_DYD

In this table there are columns like onhand, PAB, po_qty etc

####
To get the forecast details run

select /*3-29641236811*/
PDS_TABLE_NAME
from FUSION.MSC_PLAN_TABLES mpt
where 1 = 1
and mpt.PLAN_ID = 300000360997847
and ENTITY_ID = 135

In your case the PDS_TABLE_NAME is MSC_DATA_9004_DYD


In this table there are columns like gross_fcst, net_fcst etc

In each of the above dyd tables there are columns like


tim_lvl_member_id - This is the time
prd_lvl_member_id - this is the item
org_lvl_member_id - this is the org
To get the date run the below query

select
a.*
from fusion.msc_dimension_tim_dyd a, fusion.MSC_DATA_9002_DYD b
where a.tim_lvl_member_id = b.tim_lvl_member_id
and a.tim_level_id = 51

For prd_lvl_member_id this can be linked to msc_items.inventory_item_id table as


MSC_DATA_9002_DYD.tim_lvl_member_id = msc_items.inventory_item_id

For org we can use org_lvl_member_id = msc_parameters.organization_id

####
To see each individual orders For the supplies and demand table the table
MSC_ORDERS_SP_V

select
*
from fusion.MSC_ORDERS_SP_V
where plan_id = 300000360997847

Please review and let us know if you require any further information

Thanks
Santosh

You might also like