0

"WO #" (VIEW_SPS_WO_OPERATION.SI_NUMBER as "WO #") ごとに 1 行を返す必要があります。

返されるフィールドは複数の行で同じ値を示しているため、結合が正しくない可能性があります。次を除いて: 1 つの「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)結果を where に制限する必要がある WHERE 句には and が必要VIEW_WOBOM.NEXT_DELIVERY_DATE >= Now()です。NOW の計算方法は、RDBMS によって異なります。

于 2013-07-29T19:40:16.060 に答える