locked
Transferring data from two tables into another two tables at the same time. RRS feed

  • Question

  • User1814848029 posted

    I faced problems in transferring data from two tables into another two tables at the same time..

    I used LEFT OUTER JOIN to join both tables but there's still have errors..

    string UpdateOrder = "INSERT INTO Order LEFT OUTER JOIN OrderDetails ON Order.orderNo = OrderDetails.orderNo (Order.orderDate,Order.totalOrderPrice,Order.membershipNo, OrderDetails.productNo, OrderDetails.productQty, OrderDetails.subTotalOrderPrice, OrderDetails.productColor,OrderDetails.productRemarks)" +
    "SELECT ShoppingCart.cartDate,ShoppingCart.totalCartPrice,ShoppingCart.membershipNo, CartDetails.productNo, CartDetails.productQty, CartDetails.subTotalOrderPrice, CartDetails.productColor,CartDetails.productRemarks" +
    "FROM ShoppingCart LEFT OUTER JOIN CartDetails ON ShoppingCart.cartNo = CartDetails.cartNo";

    any one can help on this ???

    Sunday, November 4, 2012 1:35 AM

Answers

  • User-1199946673 posted

    I faced problems in transferring data from two tables into another two tables at the same time..

    Because you cannot insert data into 2 tables in 1 INSERT statement at the same time. You need to execute 2 INSERT statements

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, November 4, 2012 5:12 PM

All replies

  • User-1716253493 posted
    can insert into joining table?
    Sunday, November 4, 2012 6:20 AM
  • User1814848029 posted

    I want to retrieve data from two tables into another two tables.

    Sunday, November 4, 2012 12:14 PM
  • User-1199946673 posted

    I faced problems in transferring data from two tables into another two tables at the same time..

    Because you cannot insert data into 2 tables in 1 INSERT statement at the same time. You need to execute 2 INSERT statements

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, November 4, 2012 5:12 PM
  • User3866881 posted

    I used LEFT OUTER JOIN to join both tables but there's still have errors..

    What problem have you got?

    Can you elebrate it more?

    Exception?

    Sunday, November 4, 2012 8:54 PM