sql >> Databáze >  >> RDS >> Sqlserver

SQL Server 2008 filtrování

Zkuste prosím toto:

SELECT      max(dbo.WOO.WOO_LastReportedHrsDate),dbo.PLT.PLT_ItemID, SUM(dbo.PLD.PLD_IssueQty) AS Issued, dbo.WKO.WKO_WorkOrderID, dbo.WKO.WKO_RequiredQty, dbo.WKO.WKO_CompleteQty, 
                      dbo.WKO.WKO_RequiredQty - dbo.WKO.WKO_CompleteQty AS openbalance, dbo.PLT.PLT_QtyPerAssy, 
                      (dbo.WKO.WKO_CompleteQty * dbo.PLT.PLT_QtyPerAssy - SUM(dbo.PLD.PLD_IssueQty)) * - 1 AS WIP, dbo.WKO.WKO_ItemID, dbo.WOO.WOO_StatusCode, 
                      dbo.WOO.WOO_WorkCenterID
FROM         dbo.PLT INNER JOIN
                      dbo.PLD ON dbo.PLT.PLT_RecordID = dbo.PLD.PLD_PLT_RecordID INNER JOIN
                      dbo.WKO ON dbo.PLT.PLT_WorkOrderID = dbo.WKO.WKO_WorkOrderID LEFT OUTER JOIN
                      dbo.WOO ON dbo.PLT.PLT_WorkOrderID = dbo.WOO.WOO_WorkOrderID
WHERE     (dbo.WKO.WKO_StatusCode = N'Released') AND (dbo.PLT.PLT_ItemID = '9005-20-1794')
AND (dbo.WOO.WOO_LastReportedHrsDate IS NOT NULL) AND (dbo.WOO.WOO_StatusCode IS NOT NULL)
GROUP BY dbo.PLT.PLT_ItemID, dbo.WKO.WKO_WorkOrderID, dbo.WKO.WKO_RequiredQty, dbo.WKO.WKO_CompleteQty, dbo.PLT.PLT_QtyPerAssy, dbo.WKO.WKO_ItemID, 
                      dbo.WOO.WOO_StatusCode, dbo.WOO.WOO_WorkCenterID
HAVING      (SUM(dbo.PLD.PLD_IssueQty) = dbo.WKO.WKO_RequiredQty * dbo.PLT.PLT_QtyPerAssy) 
ORDER BY dbo.WKO.WKO_WorkOrderID



  1. Kde MySQL ukládá databázové soubory ve Windows a jaké jsou názvy souborů?

  2. Jak exportovat pomocí DATA_PUMP do kbelíku S3?

  3. Vygenerujte náhodnou int hodnotu od 3 do 6

  4. Chyba zablokování v příkazu INSERT