SELECT we.wip_entity_name , wl.line_code , TO_CHAR(wdj.creation_date,'DD-MON-YYYY HH24:MI:SS') creation_date , DECODE( p_org_id,4853,TO_CHAR(sajet.get_wo_date@sfisge6(we.wip_entity_name),'DD-MON-YYYY HH24:MI:SS'), TO_CHAR(sajet.get_wo_date@sfisge(we.wip_entity_name),'DD-MON-YYYY HH24:MI:SS')) start_date, msi.segment1 , msi.description, wdj.start_quantity, wdj.quantity_completed, wdj.status_type, TO_CHAR(wdj.date_completed,'fmDD-MON-YYYY HH24:MI:SS') date_completed, wdj.wip_entity_id FROM wip_discrete_jobs wdj, wip_entities we, wip_lines wl, mtl_system_items msi WHERE 1 = 1 AND we.wip_entity_id = wdj.wip_entity_id AND we.organization_id = wdj.organization_id AND msi.inventory_item_id = wdj.primary_item_id AND msi.organization_id = wdj.organization_id AND wl.line_id = wdj.line_id AND wl.organization_id = wdj.organization_id AND wdj.creation_date BETWEEN p_fm_date AND p_to_date AND wdj.organization_id = p_org_id and status_type = n_status
这是部份查询SQL 现在是要卡一个用户输入的时间不在超过180天,求各位帮忙分析思路以及部分写法。新手掌握的不是很多
qq_青瓜_03599418
相关分类