how to compare two table and save result into 3rd table

  • table1

    number sec

    1234 458

    6895 458

    2543 879

    3289 84

    table2

    number sec

    4568 56

    3289 46

    1236 755

    2543 800

    i want get result like this

    table3

    number sec

    2543 79

    3289 38

    table1's and table2's number column are unique , actually i want to do that table1's number column data search in table2 if same data found in table2 then their sec column's data subtract each other

    sorry for bad english

  • Join the two tables on number=number and do t1.sec - t2.sec for the second column of your result set. Make sure you know how you will handle the cases where the subtraction produces a negative number.

    John

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply