start code

 avatar
user_0223141589
sql
7 months ago
775 B
12
Indexable
Never
select
fvm.name as model,
spl.name as component_lot,
spl_top.name as top_level_lot,
mbv.START_DATE,
mbv.END_DATE,
mbv.START_REFERENCE,
mbv.END_REFERENCE,
mbv.START_MODEL,
mbv.END_MODEL
from BIZ.DBT_STG.STG_ODOO_PROD__AS_MAINTENANCE_BOM_VERSION mbv
left join BIZ.DBT_STG.STG_ODOO_PROD__STOCK_PRODUCTION_LOT spl on spl.id = mbv.LOT_ID
left join BIZ.DBT_STG.STG_ODOO_PROD__STOCK_PRODUCTION_LOT spl_top on spl_top.id = mbv.TOP_PARENT_LOT_ID
left join BIZ.DBT_STG.STG_ODOO_PROD__PRODUCT_PRODUCT pp on pp.id = spl.PRODUCT_ID
left join BIZ.DBT_STG.STG_ODOO_PROD__PRODUCT_TEMPLATE pt on pt.id = pp.PRODUCT_TMPL_ID
left join BIZ.DBT_STG.STG_ODOO_PROD__FLEET_VEHICLE_MODEL fvm on fvm.id = pt.PRODUCT_TEMPLATE_ROTABLE_MODEL_ID
where mbv.TOP_PARENT_LOT_ID = '86235'
order by mbv.id desc