SQL Server Performance

Combine data from two views

Discussion in 'General Developer Questions' started by Kwame, Mar 20, 2009.

  1. Kwame New Member

    I have two views pciking data from two separate tables.
    Table 1 has credit note transactions
    Table 2 has invoice transactions
    I need a single views having all the transactions (i.e. linking to the two tables)
    Any help?
    Regards
    Kwame
  2. geebee2 New Member

    You need to use "union all", for example
    select customer, total, date from Invoice
    union all
    select customer, -total, date from CreditNote
    If you omit the "all" option, duplicate rows are only output once ( which is often wrong ).

Share This Page