0

我需要为每个“WO #”返回一行(VIEW_SPS_WO_OPERATION.SI_NUMBER 作为“WO #”)

返回的字段在多行中显示相同的值,因此我的连接可能不正确除了以下内容:一个“WO #”可以有多个来自“VIEW_WOBOM.NEXT_DELIVERY_DATE”的 NEXT_DELIVERY_DATE,我只需要带有的条目最新日期(最多?)。

我希望我是清楚的。在此先感谢您的帮助。

   SELECT 
    VIEW_SPS_WO_OPERATION.COMPANY_NAME as Customer, 
    VIEW_SPS_WO_OPERATION. SI_NUMBER as "WO #",
    VIEW_SPS_WO_OPERATION. PN as "Part Number",
    VIEW_SPS_WO_OPERATION. DEPT_NAME as "Department",
    VIEW_SPS_WO_OPERATION. TOTAL_PARTS as "Extended Price",
    VIEW_SPS_WO_OPERATION.DESCRIPTION as Description,
    VIEW_WO_SUB.WORK_TYPE as "Work Req.", 
    VIEW_SPS_WO_OPERATION.STATUS_DESC as Task, 
    VIEW_SPS_WO_OPERATION.ENTRY_DATE as "Rec Date", 
    VIEW_SPS_WO_OPERATION.DUE_DATE as "Qtd Date", 
    VIEW_SPS_WO_OPERATION.EST_COMP_DATE as "App. Date", 
    VIEW_WO_TASK_STATISTICS.SKILLS_EST_HOURS  as "Est. Labor Hrs.", 
    VIEW_WO_TASK_STATISTICS.LABOR_HOURS as "Act. Labor Hrs.",
    VIEW_WOBOM.NEXT_DELIVERY_DATE

  FROM 
    GATCRGQCTL.VIEW_SPS_WO_OPERATION VIEW_SPS_WO_OPERATION,
    GATCRGQCTL.VIEW_WO_SUB VIEW_WO_SUB,
    GATCRGQCTL.VIEW_WO_TASK_STATISTICS VIEW_WO_TASK_STATISTICS,
    GATCRGQCTL.VIEW_WIP_VALUATION VIEW_WIP_VALUATION, 
    GATCRGQCTL.WO_BOM WO_BOM,
    GATCRGQCTL.VIEW_WOBOM VIEW_WOBOM
   WHERE 
    VIEW_SPS_WO_OPERATION.SI_NUMBER = VIEW_WO_SUB. SI_NUMBER 
     AND
    VIEW_WIP_VALUATION.WOO_AUTO_KEY = WO_BOM. WOO_AUTO_KEY AND
    VIEW_SPS_WO_OPERATION.WOO_AUTO_KEY = VIEW_WIP_VALUATION.WOO_AUTO_KEY AND
    WO_BOM.WOT_AUTO_KEY = VIEW_WO_TASK_STATISTICS.WOT_AUTO_KEY
     AND
    WO_BOM.WOT_AUTO_KEY = VIEW_WOBOM.WOT_AUTO_KEY
4

1 回答 1

1

您需要MIN(VIEW_WOBOM.NEXT_DELIVERY_DATE)and 在您的 WHERE 子句中,您需要将结果限制为 where VIEW_WOBOM.NEXT_DELIVERY_DATE >= Now()。您现在如何计算将取决于您的 RDBMS。

于 2013-07-29T19:40:16.060 回答