Sqlserver
 sql >> Teknologi Basis Data >  >> RDS >> Sqlserver

Pemfilteran SQL Server 2008

Silakan coba ini:

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. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Ekspor data xml menggunakan Perintah BCP di SQL Server

  2. Bagaimana cara mendapatkan satu bulan yang lalu dari hari ini di SQL Server 2008?

  3. Bisakah saya menggunakan banyak kursor pada satu koneksi dengan pyodbc dan MS SQL Server?

  4. Bagaimana IIF() Bekerja di SQL Server

  5. Bagaimana Cara mendapatkan Query Grup SQL Formulir Baris Pertama?