Home Forums SQL Server 2005 SQL Server 2005 General Discussion How to join multiple tables (SQL) to find the difference between an order and shipped quantities? RE: How to join multiple tables (SQL) to find the difference between an order and shipped quantities?

  • CREATE TABLE [dbo].[ORDER](

    [ID] [int] IDENTITY(1,1) NOT NULL,

    [OrderRef1] [varchar](10) NULL,

    [OrderRef2] [varchar](10) NULL,

    [OrderDate] [varchar](10) NULL,

    [Shipped] [bit] NOT NULL,

    [ReceiptSent] [bit] NOT NULL,

    )

    CREATE TABLE [dbo].[orderITEMS](

    [ID] [int] IDENTITY(1,1) NOT NULL,

    [OutboundDeliveryID] [int] NOT NULL,

    [OrderLineNr] [int] NULL,

    [ItemNumber] [varchar](18) NULL,

    [BatchNr] [varchar](10) NULL,

    [QtyToShip] [varchar](13) NULL,

    )

    CREATE TABLE [dbo].[Shipping](

    [ID] [int] IDENTITY(1,1) NOT NULL,

    [Client] [int] NULL,

    [PO] [nvarchar](255) NULL,

    [Date] [datetime] NULL,

    )

    CREATE TABLE [dbo].[ShippingArchive](

    [ID] [int] IDENTITY(1,1) NOT NULL,

    [OrigID] [int] NULL,

    [Client] [int] NULL,

    [ProductCode] [nvarchar](25) NULL,

    [LotID] [int] NULL,

    [Lot] [nvarchar](25) NULL,

    [Qty] [int] NULL,

    [StatusID] [int] NULL,

    [StatusDate] [datetime] NULL,

    )