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?

  • insert myOrder

    select 1511,'0080014959',NULL,'11/07/2013',1,1 union all

    select 1510,'0080014957',NULL,'11/07/2013',1,1

    insert orderITEMS

    select 1646,1511,900001,'71034600','13EM10643',1 union all

    select 1645,1510,10,'71034600','13EM10643',1

    insert shipping

    select 177620,400,'0080014959','2013-07-11 00:00:00.000' union all

    select 177618,400,'0080014957','2013-07-11 00:00:00.000'

    insert shippingArchive

    select 4262720,0,400,'71034600',2838356,'13EM10643',1,177618,'2013-07-11 00:00:00.000' union all

    select 4262722,0,400,'71034600',2838356,'13EM10643',1,177620,'2013-07-11 00:00:00.000'